diff --git a/testing/test_mark.py b/testing/test_mark.py index 9b3e15b37e3..cf59baed986 100644 --- a/testing/test_mark.py +++ b/testing/test_mark.py @@ -418,6 +418,32 @@ def test_bar(self): pass items, rec = testdir.inline_genitems(p) self.assert_markers(items, test_foo=('a', 'b'), test_bar=('a',)) + + @pytest.mark.issue568 + @pytest.mark.xfail(reason="markers smear on methods of base classes") + def test_mark_should_not_pass_to_siebling_class(self, testdir): + p = testdir.makepyfile(""" + import pytest + + class TestBase: + def test_foo(self): + pass + + @pytest.mark.b + class TestSub(TestBase): + pass + + + class TestOtherSub(TestBase): + pass + + """) + items, rec = testdir.inline_genitems(p) + base_item, sub_item, sub_item_other = items + assert not hasattr(base_item.obj, 'b') + assert not hasattr(sub_item_other.obj, 'b') + + def test_mark_decorator_baseclasses_merged(self, testdir): p = testdir.makepyfile(""" import pytest