I have a very simple test script just to learn pytest, tmp.py:
def square(x):
return x*x
def test_square():
assert square(4) == 16
Using Pycharm to run this script, I've configured my project setting such that pytest is used as my default test runner. When I run the above code I get the following error:
/Users/mingxiao/webdav_2.7.5/bin/python /Applications/PyCharm.app/helpers/pycharm/pytestrunner.py -p pytest_teamcity /Users/mingxiao/dev/juggernaut/src/integrations/webDAV/demo/tmp.py "-k test_square"
Testing started at 4:41 PM ...
Traceback (most recent call last):
File "/Applications/PyCharm.app/helpers/pycharm/pytestrunner.py", line 51, in <module>
main()
File "/Applications/PyCharm.app/helpers/pycharm/pytestrunner.py", line 20, in main
_pluginmanager = PluginManager(load=True)
TypeError: __init__() got an unexpected keyword argument 'load'
Process finished with exit code 1
I am running PyCharm 3.0 Professional edition, pytest 2.4.2, and python 2.7.5. It seems that its PyCharm itself that is causing the problem.
It appears to be an incompatibility between PyCharm and py.test 2.4.x. If you install py.test 2.3.5 (for example, pip install pytest==2.3.5
) it works fine. I suggest submitting a bug report to JetBrains.
PyCharm pytest helper does not seem to be compatible with newer pytest. Until they fix it, replacing it with the contents of your py.test script works just fine.
Helper is located at PyCharm.app/helpers/pycharm/pytestrunner.py
(you can see this path when trying to run tests). Just put the output of cat `which py.test`
in it, for me it is:
__requires__ = 'pytest==2.5.1'
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.exit(
load_entry_point('pytest==2.5.1', 'console_scripts', 'py.test')()
)
It seems issue was created in pycharm tracker http://youtrack.jetbrains.com/issue/PY-11235
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With