By default, the "extra" test is skipped:
$ py.test test.py -vv
================== test session starts ==================
platform linux -- Python 3.6.2, ...
cachedir: .../.cache
rootdir: ${ROOTDIR}, inifile: setup.cfg
plugins: cov-2.5.1
collected 3 items
test.py::test_it[40-42] PASSED
test.py::test_it[0-2] SKIPPED
test.py::test_too[11-12-23] PASSED
========== 2 passed, 1 skipped in 0.01 seconds ==========
However, if the flag to activate it is used, the second test is run:
$ py.test test.py --hey-you-guys -vv
================== test session starts ==================
platform linux -- Python 3.6.2, ...
cachedir: .../.cache
rootdir: ${ROOTDIR}, inifile: setup.cfg
plugins: cov-2.5.1
collected 4 items
test.py::test_it[40-42] PASSED
test.py::test_it[0-2] PASSED
test.py::test_too[11-12-23] PASSED
test.py::test_too[20-31.5-51.5] PASSED
================ 4 passed in 0.01 seconds ===============
Also note the "magical" appearance of a fourth test test_too[20-31.5-51.5]
.
This is due to a different approach than was used to skip test_it[0-2]
.
Instead of using a pytest.mark
to skip the case, it was instead omitted
from the cases passed to pytest.mark.parametrize
.