Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Data Science by (18.4k points)

I can run the 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 ===================================

These are the following two commands

pytest -m tests

pytest -m test

This is the result i got. My question is why all my tests are deselected while they can be run as a 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 Answer

0 votes
by (36.8k points)

You're using the -m which filters which tests to run according to how you mark your tests. You're telling a pytest to only run tests tagged @pytest.mark.test.

Presumably, you don't have any tests marked as such.

Want to be a master in Data Science? Enroll in this Data Science Courses

Browse Categories

...