Pycharm Behave Runner ImportError
I am attempting to run behave tests via Pycharm 2017.1. I have a run configuration set up, including the working directory set to the directory my behave tests are located in.
Every time I run a Behave test I get an error like the following:
.../python/bin/python2.7.../pycharm-2017.1/helpers/pycharm/behave_runner.py
Testing started at 09:23 ...
Traceback (most recent call last):
File .../pycharm-2017.1/helpers/pycharm/behave_runner.py", line 16, in <module>
from behave.formatter.base import Formatter
ImportError: No module named formatter.base
Process finished with exit code 1
In the IDE I can ctrl-click the formatter.base import line in behave_runner.py and I'm taken to the module - so I can see that the module does exist.
I have tried changing the Python interpreter I'm using to a virtualenv and changing the working directory in the behave run configuration. I already have the behave package installed for both of the python interpreters I have tried. I can also run behave from a terminal with no problems. The behave version is behave 1.2.5.
Please sign in to leave a comment.
I resolved this issue by grabbing a fresh working copy from version control.and setting up Pycharm for the project from scratch. Now I can run behave tests from within my IDE.
I assume that the cause was that some kind of metadata had become corrupt that the "invalidate caches and restart" Pycharm functionality could not fix.