From 8aa6789da9491df5aba4665f6174d4da5f416fe7 Mon Sep 17 00:00:00 2001 From: Marko Pacak Date: Thu, 1 Dec 2022 14:38:26 +0100 Subject: [PATCH] refactor if-statement --- src/_pytest/python.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/_pytest/python.py b/src/_pytest/python.py index 79cf0476b..e143d28d1 100644 --- a/src/_pytest/python.py +++ b/src/_pytest/python.py @@ -403,8 +403,8 @@ class PyCollector(PyobjMixin, nodes.Collector): def istestfunction(self, obj: object, name: str) -> bool: if self.funcnamefilter(name) or self.isnosetest(obj): - if isinstance(obj, staticmethod) or isinstance(obj, classmethod): - # staticmethods need to be unwrapped. + if isinstance(obj, (staticmethod, classmethod)): + # staticmethods and classmethods need to be unwrapped. obj = safe_getattr(obj, "__func__", False) return callable(obj) and fixtures.getfixturemarker(obj) is None else: