Skip to content

Commit 7a62548

Browse files
committed
PR suggestions
1 parent ebd571b commit 7a62548

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

src/_pytest/doctest.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -537,17 +537,19 @@ def _find(
537537
tests, obj, name, module, source_lines, globs, seen
538538
)
539539

540-
def _from_module(self, module, object):
541-
"""`cached_property` objects will are never considered a part
542-
of the 'current module'. As such they are skipped by doctest.
543-
Here we override `_from_module` to check the underlying
544-
function instead. https://github.com/python/cpython/issues/107995
545-
"""
546-
if isinstance(object, functools.cached_property):
547-
object = object.func
540+
if sys.version_info < (3, 13):
548541

549-
# Type ignored because this is a private function.
550-
return super()._from_module(module, object) # type: ignore[misc]
542+
def _from_module(self, module, object):
543+
"""`cached_property` objects are never considered a part
544+
of the 'current module'. As such they are skipped by doctest.
545+
Here we override `_from_module` to check the underlying
546+
function instead. https://github.com/python/cpython/issues/107995
547+
"""
548+
if isinstance(object, functools.cached_property):
549+
object = object.func
550+
551+
# Type ignored because this is a private function.
552+
return super()._from_module(module, object) # type: ignore[misc]
551553

552554
if self.path.name == "conftest.py":
553555
module = self.config.pluginmanager._importconftest(

0 commit comments

Comments
 (0)