小编Mal*_*and的帖子

如何在 Eclipse 上运行 pytest?

我是单元测试新手,“我正在尝试在 Eclipse 上运行pytest。我已经搜索了几个小时,但我似乎无法找出问题所在。我正在尝试使用https://pytest 中的简单示例。 org网站。我的问题是它pytest不能在 Eclipse 上运行。我可以使用命令提示符进行测试,但我更愿意在控制台窗口上看到结果。

我尝试过但没有成功的事情;

  • PyUnit将测试运行程序设置为Py.test运行程序(而不是默认的 Pydev 测试运行程序)

在这种情况下,我收到以下错误消息

用法:runfiles.py [选项] [file_or_dir] [file_or_dir] [...] runfiles.py:错误:无法识别的参数:--verbosity inifile:无 rootdir:C:\ peepee \ pytest \ testing

  • 我已将详细程度设置为 9(在某处读到它是最大值)。没有任何区别。

我试图从http://pytest.org网站测试简单的代码

def func(x):
    return x + 1

def test_answer():
    assert func(3) == 5
Run Code Online (Sandbox Code Playgroud)

可以通过 cmd 运行,但不能在 Eclipse 上运行。

请帮忙,因为我正在浪费时间试图解决这个问题。提前致谢

python eclipse unit-testing pytest

5
推荐指数
1
解决办法
8229
查看次数

标签 统计

eclipse ×1

pytest ×1

python ×1

unit-testing ×1