PyCharm Reports Behave Decorators as Unresolved References

I used the Python package behave to perform functional testing of my Python project.

When I open the directory containing my file steps.py, PyCharm reports "unresolved reference 'given'" (or 'then' or 'when') for all the decorators of my steps.

How do I configure PyCharm to resolve these references?

Thanks.
2 comments
The behave module uses Python features to evaluate its attributes like given. The code inspections cannot analyze them statically, special handling is required.

Please vote for PY-8427 if you are interested in behave support, incl. running feature files as tests. Note that there is another feature request about the Lettuce BDD tool PY-4186.
0
I have voted for PY-8427; however, I also found a work around by conditionally importing the given, when and then definitions in my steps.py file. In addition, although I've not yet tried it, my installation of Python (I have several side-by-side on my machine) does NOT have the behave package. I think I might be able to work around the issue by running in a different Python environment.

Thanks for your help.

Have a great day!
0

Please sign in to leave a comment.