Skip to content

Commit 9140d4f

Browse files
committed
Add test for --deselect without "::()"
Closes: pytest-dev#4127.
1 parent a2d001c commit 9140d4f

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

testing/test_session.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,16 +274,26 @@ def test_deselect(testdir):
274274
testdir.makepyfile(
275275
test_a="""
276276
import pytest
277+
277278
def test_a1(): pass
279+
278280
@pytest.mark.parametrize('b', range(3))
279281
def test_a2(b): pass
282+
283+
class TestClass:
284+
def test_c1(self): pass
285+
286+
def test_c2(self): pass
280287
"""
281288
)
282289
result = testdir.runpytest(
283-
"-v", "--deselect=test_a.py::test_a2[1]", "--deselect=test_a.py::test_a2[2]"
290+
"-v",
291+
"--deselect=test_a.py::test_a2[1]",
292+
"--deselect=test_a.py::test_a2[2]",
293+
"--deselect=test_a.py::TestClass::test_c1",
284294
)
285295
assert result.ret == 0
286-
result.stdout.fnmatch_lines(["*2 passed, 2 deselected*"])
296+
result.stdout.fnmatch_lines(["*3 passed, 3 deselected*"])
287297
for line in result.stdout.lines:
288298
assert not line.startswith(("test_a.py::test_a2[1]", "test_a.py::test_a2[2]"))
289299

0 commit comments

Comments
 (0)