Why pytest deselect all the tests when run with python -m test?

Viewed 2155

I can run my tests by executing (on Windows)

pytest .\tests\test_x.py

Result:

================================= 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 ===================================

However, the following two commands

pytest -m tests
pytest -m test

got the following result. Why all the tests are deselected while they can be run as script?

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 Answers
Related