add tests for #3441

This commit is contained in:
Ronny Pfannschmidt 2018-05-03 17:01:47 +02:00
parent a5cf55dd4a
commit e6a86e0f4c
1 changed files with 32 additions and 0 deletions

View File

@ -927,3 +927,35 @@ def test_parameterset_for_parametrize_marks(testdir, mark):
def test_parameterset_for_parametrize_bad_markname(testdir): def test_parameterset_for_parametrize_bad_markname(testdir):
with pytest.raises(pytest.UsageError): with pytest.raises(pytest.UsageError):
test_parameterset_for_parametrize_marks(testdir, 'bad') test_parameterset_for_parametrize_marks(testdir, 'bad')
def test_mark_expressions_no_smear(testdir):
testdir.makepyfile("""
import pytest
class BaseTests(object):
def test_something(self):
pass
@pytest.mark.FOO
class TestFooClass(BaseTests):
pass
@pytest.mark.BAR
class TestBarClass(BaseTests):
pass
""")
reprec = testdir.inline_run("-m", 'FOO')
passed, skipped, failed = reprec.countoutcomes()
dlist = reprec.getcalls("pytest_deselected")
assert passed == 1
assert skipped == failed == 0
deselected_tests = dlist[0].items
assert len(deselected_tests) == 1
# keywords smear - expected behaviour
reprec_keywords = testdir.inline_run("-k", 'FOO')
passed_k, skipped_k, failed_k = reprec_keywords.countoutcomes()
assert passed_k == 2
assert skipped_k == failed_k == 0