我正在尝试在pycharm中运行带覆盖的py.test。在我的家用电脑上,它就像一个魅力,但在我的笔记本电脑上我得到这个堆栈跟踪
/home/david/PycharmProjects/pyCardDeck/virtualenv/bin/python /opt/pycharm/helpers/coverage_runner/run_coverage.py run --omit=\"/opt/pycharm/helpers*\" /opt/pycharm/helpers/pycharm/pytestrunner.py -p pytest_teamcity /home/david/PycharmProjects/pyCardDeck tests
Testing started at 13:15 ...
============================= test session starts ==============================
platform linux -- Python 3.5.2, pytest-3.0.1, py-1.4.31, pluggy-0.3.1
rootdir: /home/david/PycharmProjects/pyCardDeck, inifile:
plugins: cov-2.3.1
collected 35 items
tests/test_card.py ..
tests/test_deck.py ..............................Traceback (most recent call last):
File "/opt/pycharm/helpers/coverage_runner/run_coverage.py", line 44, in <module>
main()
File "/home/david/PycharmProjects/pyCardDeck/virtualenv/lib/python3.5/site-packages/coverage/cmdline.py", line 753, in main
...
========================== 35 passed in 0.89 seconds ===========================
status = CoverageScript().command_line(argv)
File "/home/david/PycharmProjects/pyCardDeck/virtualenv/lib/python3.5/site-packages/coverage/cmdline.py", line 480, in command_line
return self.do_run(options, args)
File "/home/david/PycharmProjects/pyCardDeck/virtualenv/lib/python3.5/site-packages/coverage/cmdline.py", line 638, in do_run
self.coverage.export()
AttributeError: 'Coverage' object has no attribute 'export'
Process finished with exit code 1
手动运行py.test --cov工作,所以它是Pycharm魔法内部的东西。我的笔记本电脑正在运行Pycharm 2016.1.4和覆盖率4.2
答案 0 :(得分:1)
cmdline.py中的该行应为self.coverage.save()
。它从未说过export
。你应该重新安装coverage.py。我不知道是什么改变了它。