diff options
author | Ronny Pfannschmidt <opensource@ronnypfannschmidt.de> | 2018-05-03 17:01:47 +0200 |
---|---|---|
committer | Ronny Pfannschmidt <opensource@ronnypfannschmidt.de> | 2018-05-03 17:33:59 +0200 |
commit | e6a86e0f4c2c5b1b600e86eda8d1ba545142ac72 (patch) | |
tree | 1880f4425fdcc008d2d63abb89d64e43d267883b /testing | |
parent | a5cf55dd4a5237ad4b5d6e93d9822558bbc8cd28 (diff) | |
download | pytest-e6a86e0f4c2c5b1b600e86eda8d1ba545142ac72.tar.gz |
add tests for #3441
Diffstat (limited to 'testing')
-rw-r--r-- | testing/test_mark.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/testing/test_mark.py b/testing/test_mark.py index 520712895..31d3af3e5 100644 --- a/testing/test_mark.py +++ b/testing/test_mark.py @@ -927,3 +927,35 @@ def test_parameterset_for_parametrize_marks(testdir, mark): def test_parameterset_for_parametrize_bad_markname(testdir): with pytest.raises(pytest.UsageError): 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 |