PR suggestions
This commit is contained in:
parent
ebd571bb18
commit
7a625481da
|
@ -537,17 +537,19 @@ class DoctestModule(Module):
|
||||||
tests, obj, name, module, source_lines, globs, seen
|
tests, obj, name, module, source_lines, globs, seen
|
||||||
)
|
)
|
||||||
|
|
||||||
def _from_module(self, module, object):
|
if sys.version_info < (3, 13):
|
||||||
"""`cached_property` objects will are never considered a part
|
|
||||||
of the 'current module'. As such they are skipped by doctest.
|
|
||||||
Here we override `_from_module` to check the underlying
|
|
||||||
function instead. https://github.com/python/cpython/issues/107995
|
|
||||||
"""
|
|
||||||
if isinstance(object, functools.cached_property):
|
|
||||||
object = object.func
|
|
||||||
|
|
||||||
# Type ignored because this is a private function.
|
def _from_module(self, module, object):
|
||||||
return super()._from_module(module, object) # type: ignore[misc]
|
"""`cached_property` objects are never considered a part
|
||||||
|
of the 'current module'. As such they are skipped by doctest.
|
||||||
|
Here we override `_from_module` to check the underlying
|
||||||
|
function instead. https://github.com/python/cpython/issues/107995
|
||||||
|
"""
|
||||||
|
if isinstance(object, functools.cached_property):
|
||||||
|
object = object.func
|
||||||
|
|
||||||
|
# Type ignored because this is a private function.
|
||||||
|
return super()._from_module(module, object) # type: ignore[misc]
|
||||||
|
|
||||||
if self.path.name == "conftest.py":
|
if self.path.name == "conftest.py":
|
||||||
module = self.config.pluginmanager._importconftest(
|
module = self.config.pluginmanager._importconftest(
|
||||||
|
|
Loading…
Reference in New Issue