From e6a86e0f4c2c5b1b600e86eda8d1ba545142ac72 Mon Sep 17 00:00:00 2001 From: Ronny Pfannschmidt Date: Thu, 3 May 2018 17:01:47 +0200 Subject: [PATCH] add tests for #3441 --- testing/test_mark.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) 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