Specifiy another location for Behave step definitions in PyCharm

At work, we have accumulated quite some step definitions in our bigger projects that somehow overlap. Hence, we decided that we want to factor out the step definitions into a separate package and use this accross multiple Django apps.

My idea was to create the features/steps directoy in any Django app that wants to use the package with the following contents:

from our_testing_package.steps import *

While this works with behave without a problem, we loose the convenient and great features of the BDD integration that PyCharm offers, e.g. autocompletion and generation of step definition from our feature file. Especially the first is crucial with this many step definitions.

I suppose PyCharm simply looks into each python file inside the features/steps directory and analyses the text inside them by looking for step definitions.

Is there a possiblity to tell PyCharm that there is another folder with step definitions or if I have to adapt my python code in a way that PyCharm can follow the link to the external package?

1 comment
Comment actions Permalink

Hi,

You should be able to achieve that by adding that "another" folder to **File | Settings | Project: moviedb | Project Structure**, and marking it as "Sources".

Have you tried that?

0

Please sign in to leave a comment.