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, 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?

Comment actions Permalink
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.
Comment actions Permalink
I have voted for PY-8427; however, I also found a work around by conditionally importing the given, when and then definitions in my 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!

Please sign in to leave a comment.