python - pycharm pytestrunner PluginManager 意外的关键字参数

标签 python pycharm pytest

我有一个非常简单的测试脚本只是为了学习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/

相关文章:

python - 如何在导入时忽略某些Python模块?

python - 如何使用 Python MonkeyPatch + Mock 来断言调用了一个函数

python - MySQL WorkBench 如何自动重新运行查询?

python - 如何使用标签对 DataFrame 进行分组并对它们求和?

python - 在 pyCharm 或任何 IDE 中选择配对大括号之间的内容

pycharm - Jupyter 在 Pycharm 中的 shift+tab 行为?

python - 在 pytest.ini 中设置不同的测试路径

python - 将上下文管理器与 multiprocessing.Manager 一起使用有什么好处?

python - 如何在 Pandas DataFrame 中一次获取多列的值计数?

python - PyCharm 中有 "Edit and Continue"吗?像在 Eclipse/PyDev 中那样将代码重新加载到正在运行的程序中?