为什么使用 python -m test 运行pytest会取消所有测试?

4
我可以通过执行以下命令(在Windows上)来运行我的测试:
pytest .\tests\test_x.py

结果:

================================= test session starts ==================================
platform win32 -- Python 3.8.3, pytest-5.4.3, py-1.9.0, pluggy-0.13.1
rootdir: C:\Users\......
collected 9 items

tests\test_x.py .........                                                         [100%]

================================== 9 passed in 3.67s ===================================

然而,以下两个命令

pytest -m tests
pytest -m test

我得到了以下结果。为什么所有测试都被取消选择,而它们可以作为脚本运行?

PS C:\Users\......> pytest -m test
================================= test session starts ==================================
platform win32 -- Python 3.8.3, pytest-5.4.3, py-1.9.0, pluggy-0.13.1
rootdir: C:\Users\......
collected 9 items / 9 deselected

================================ 9 deselected in 3.78s =================================
1个回答

3

4
谢谢。我意识到我想做的是 python -m pytest - ca9163d9

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接