Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pycharm pytestrunner PluginManager unexpected keyword argument

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.

like image 978
mingxiao Avatar asked Oct 07 '13 23:10

mingxiao


3 Answers

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.

like image 154
tctimmeh Avatar answered Oct 23 '22 23:10

tctimmeh


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')()
      )
like image 2
letitbee Avatar answered Oct 23 '22 23:10

letitbee


It seems issue was created in pycharm tracker http://youtrack.jetbrains.com/issue/PY-11235

like image 1
l0ki Avatar answered Oct 23 '22 22:10

l0ki