Skip to content

Commit ec34f1c

Browse files
committed
Fix compatibility with python pre-3.10
1 parent 495459d commit ec34f1c

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/_pytest/mark/structures.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -349,12 +349,9 @@ def __call__(self, *args: object, **kwargs: object):
349349
if args and not kwargs:
350350
func = args[0]
351351
is_class = inspect.isclass(func)
352-
if len(args) == 1 and (istestfunc(func) or is_class):
353-
if isinstance(func, staticmethod):
354-
# If the marker decorates a staticmethod, store on the test func
355-
store_mark(func.__func__, self.mark, stacklevel=3)
356-
else:
357-
store_mark(func, self.mark, stacklevel=3)
352+
marking_func = func.__func__ if isinstance(func, staticmethod) else func
353+
if len(args) == 1 and (istestfunc(marking_func) or is_class):
354+
store_mark(marking_func, self.mark, stacklevel=3)
358355
return func
359356
return self.with_args(*args, **kwargs)
360357

0 commit comments

Comments
 (0)