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 across multiple Django apps.
My idea was to create the features/steps
directory 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, eg 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 possibility 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?
I usually do one of two things:
Add a custom path to the interpreter.
Create a batch script that sets all my path variables and then kicks off PyCharm from the script. I like this to test that my project will run in a clean environment without any settings tied to PyCharm.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.