Skip to content

Commit ec60713

Browse files
committed
Additional sanity tests, and fixes
1 parent 27d1a2f commit ec60713

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

changelog/12863.bugfix.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Fix :func:`pytest.mark.parametrize <pytest.mark.xfail>` marker placed above `@staticmethod`
1+
Fix :ref:`pytest.mark.parametrize <pytest.mark.parametrize ref>` marker placed above `@staticmethod`

testing/test_mark.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,7 +1230,11 @@ def test_attrs(self):
12301230

12311231
# @pytest.mark.issue("https://github.com/pytest-dev/pytest/issues/12863")
12321232
def test_mark_parametrize_over_staticmethod(pytester: Pytester) -> None:
1233-
foo = pytester.makepyfile(
1233+
"""Check that applying marks works as intended on classmethods and staticmethods.
1234+
1235+
Regression test for #12863.
1236+
"""
1237+
pytester.makepyfile(
12341238
"""
12351239
import pytest
12361240
@@ -1240,11 +1244,21 @@ class TestClass:
12401244
def test_classmethod_wrapper(cls, value: int):
12411245
assert value in [1, 2]
12421246
1247+
@classmethod
1248+
@pytest.mark.parametrize("value", [1, 2])
1249+
def test_classmethod_wrapper_on_top(cls, value: int):
1250+
assert value in [1, 2]
1251+
12431252
@pytest.mark.parametrize("value", [1, 2])
12441253
@staticmethod
12451254
def test_staticmethod_wrapper(value: int):
12461255
assert value in [1, 2]
1256+
1257+
@staticmethod
1258+
@pytest.mark.parametrize("value", [1, 2])
1259+
def test_staticmethod_wrapper_on_top(value: int):
1260+
assert value in [1, 2]
12471261
"""
12481262
)
1249-
result = pytester.runpytest(foo)
1250-
result.assert_outcomes(passed=4)
1263+
result = pytester.runpytest()
1264+
result.assert_outcomes(passed=8)

0 commit comments

Comments
 (0)