MCPcopy Create free account
hub / github.com/pytest-dev/pytest / test_deselect

Function test_deselect

testing/test_session.py:292–317  ·  view source on GitHub ↗
(pytester: Pytester)

Source from the content-addressed store, hash-verified

290
291
292def test_deselect(pytester: Pytester) -> None:
293 pytester.makepyfile(
294 test_a="""
295 import pytest
296
297 def test_a1(): pass
298
299 @pytest.mark.parametrize('b', range(3))
300 def test_a2(b): pass
301
302 class TestClass:
303 def test_c1(self): pass
304
305 def test_c2(self): pass
306 """
307 )
308 result = pytester.runpytest(
309 "-v",
310 "--deselect=test_a.py::test_a2[1]",
311 "--deselect=test_a.py::test_a2[2]",
312 "--deselect=test_a.py::TestClass::test_c1",
313 )
314 assert result.ret == 0
315 result.stdout.fnmatch_lines(["*3 passed, 3 deselected*"])
316 for line in result.stdout.lines:
317 assert not line.startswith(("test_a.py::test_a2[1]", "test_a.py::test_a2[2]"))
318
319
320def test_sessionfinish_with_start(pytester: Pytester) -> None:

Callers

nothing calls this directly

Calls 3

fnmatch_linesMethod · 0.80
makepyfileMethod · 0.45
runpytestMethod · 0.45

Tested by

no test coverage detected