Mat*_*shi 7 python pytest python-3.x
我正在尝试使用以下命令在 Python 3.6 上使用 pytest 运行特定的测试方法:
pytest sanity_test.py::test_check
Run Code Online (Sandbox Code Playgroud)
(如 pytest文档中所述)
它失败并显示以下错误消息:
ERROR: not found: <rootdir>/tests/automation/sanity/sanity_test.py::test_check
(no name '<rootdir>/tests/automation/sanity/sanity_test.py::test_check' in any of [<DoctestModule 'tests/automation/sanity/sanity_test.py'>, <Module
'tests/automation/sanity/sanity_test.py'>])
Run Code Online (Sandbox Code Playgroud)
当我运行整个测试文件时,测试运行正常:
pytest sanity_test.py
Run Code Online (Sandbox Code Playgroud)
当我尝试在孤立项目中运行特定方法时,它运行良好。
pytest 无法在我的项目中具体找到我的测试方法的任何原因?
该文件非常简单,如下所示:
def test_check():
pass
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2084 次 |
| 最近记录: |