File tree Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Original file line number Diff line number Diff line change 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 `
Original file line number Diff line number Diff line change @@ -1230,7 +1230,11 @@ def test_attrs(self):
1230
1230
1231
1231
# @pytest.mark.issue("https://github.com/pytest-dev/pytest/issues/12863")
1232
1232
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 (
1234
1238
"""
1235
1239
import pytest
1236
1240
@@ -1240,11 +1244,21 @@ class TestClass:
1240
1244
def test_classmethod_wrapper(cls, value: int):
1241
1245
assert value in [1, 2]
1242
1246
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
+
1243
1252
@pytest.mark.parametrize("value", [1, 2])
1244
1253
@staticmethod
1245
1254
def test_staticmethod_wrapper(value: int):
1246
1255
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]
1247
1261
"""
1248
1262
)
1249
- result = pytester .runpytest (foo )
1250
- result .assert_outcomes (passed = 4 )
1263
+ result = pytester .runpytest ()
1264
+ result .assert_outcomes (passed = 8 )
You can’t perform that action at this time.
0 commit comments