summaryrefslogtreecommitdiff
path: root/testing/test_session.py
diff options
context:
space:
mode:
authorDaniel Hahler <git@thequod.de>2018-11-09 11:28:51 +0100
committerDaniel Hahler <git@thequod.de>2018-11-10 23:46:41 +0100
commit87254ca59352124afecf13d3cbf62268ae54dd98 (patch)
tree2306f7498ceb4a0c9a77733b90441cdd6a64c4ba /testing/test_session.py
parentac8b9c6e9dbb66114a1c3f79cd1fdeb0b2b2c54d (diff)
downloadpytest-87254ca59352124afecf13d3cbf62268ae54dd98.tar.gz
Add test for --deselect without "::()"
Closes: https://github.com/pytest-dev/pytest/issues/4127.
Diffstat (limited to 'testing/test_session.py')
-rw-r--r--testing/test_session.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/testing/test_session.py b/testing/test_session.py
index c1785b916..fed39195c 100644
--- a/testing/test_session.py
+++ b/testing/test_session.py
@@ -274,16 +274,26 @@ def test_deselect(testdir):
testdir.makepyfile(
test_a="""
import pytest
+
def test_a1(): pass
+
@pytest.mark.parametrize('b', range(3))
def test_a2(b): pass
+
+ class TestClass:
+ def test_c1(self): pass
+
+ def test_c2(self): pass
"""
)
result = testdir.runpytest(
- "-v", "--deselect=test_a.py::test_a2[1]", "--deselect=test_a.py::test_a2[2]"
+ "-v",
+ "--deselect=test_a.py::test_a2[1]",
+ "--deselect=test_a.py::test_a2[2]",
+ "--deselect=test_a.py::TestClass::test_c1",
)
assert result.ret == 0
- result.stdout.fnmatch_lines(["*2 passed, 2 deselected*"])
+ result.stdout.fnmatch_lines(["*3 passed, 3 deselected*"])
for line in result.stdout.lines:
assert not line.startswith(("test_a.py::test_a2[1]", "test_a.py::test_a2[2]"))