我有一个非常简单的测试脚本只是为了学习pytest,tmp.py:
def square(x):
return x*x
def test_square():
assert square(4) == 16
使用 Pycharm 运行此脚本,我配置了我的项目设置,以便将 pytest 用作我的默认测试运行程序。当我运行上面的代码时,出现以下错误:
/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
我正在运行 PyCharm 3.0 专业版、pytest 2.4.2 和 python 2.7.5。似乎是 PyCharm 本身导致了问题。
最佳答案
这似乎是 PyCharm 和 py.test 2.4.x 之间的不兼容。如果您安装 py.test 2.3.5(例如,pip install pytest==2.3.5
),它可以正常工作。我建议向 JetBrains 提交错误报告。
关于python - pycharm pytestrunner PluginManager 意外的关键字参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19236745/