【问题标题】:how to debug or run pytest scripts using eclipse?如何使用 Eclipse 调试或运行 pytest 脚本?
【发布时间】:2016-10-25 10:21:52
【问题描述】:

我已经安装了pytest framework

我可以使用以下命令运行测试用例。

 py.test -q test_class.py

如何使用 eclipse 运行相同的测试?

【问题讨论】:

  • 你在使用 PyDev 吗?见pydev.org/manual_adv_pyunit.html
  • 是的,通过更改以下设置可以正常工作 谢谢。从 Eclipse Window->Preferences -->PyUnit --> 将 Test runner 更改为“Py.test runner”。然后选择 testcase (test_class.py) --> Run As --> Python Unit-Test
  • 如果您已经解决了问题,您可以编写(并接受!)您自己的答案。见stackoverflow.com/help/how-to-answer

标签: python eclipse pytest


【解决方案1】:

从 eclipse Window->Preferences --> pydev --> PyUnit --> 将 Test runner 更改为“Py.test runner”。

在文件上单击鼠标右键。 运行方式 --> Python 单元测试

或者按Ctrl+F9:-

它会提示你选择测试

【讨论】:

  • 如果我作为 python test 运行,它作为 python test_class.py 运行。
  • 试试 Ctrl+F9。这将提示您选择课程
  • @LavakuamrSangeetham :--- 这也不好用??
  • 我试过了,但我无法使用 Ctrl+F9 选择 Py.test 运行器
  • 它在我的系统中运行。它会起作用的!可能需要在 Eclipse 中更改一些首选项设置。不确定!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2018-07-26
  • 2013-10-21
  • 1970-01-01
  • 2010-12-04
  • 2017-05-14
  • 2010-11-07
  • 1970-01-01
相关资源
最近更新 更多