Skip to content

Commit 4d119c5

Browse files
committed
doctest_docutils(refactor[DocutilsDocTestFinder]): Remove dead _from_module method
why: Method is unreachable and would fail if called what: - Remove _from_module override from DocutilsDocTestFinder - Method called super()._from_module() but class has no parent - Copied from pytest's MockAwareDocTestFinder but not applicable here - DocutilsDocTestFinder parses documents, not Python modules - Remove unused functools import
1 parent 112d89a commit 4d119c5

1 file changed

Lines changed: 0 additions & 27 deletions

File tree

src/doctest_docutils.py

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from __future__ import annotations
44

55
import doctest
6-
import functools
76
import linecache
87
import logging
98
import os
@@ -402,32 +401,6 @@ def condition(node: Node) -> bool:
402401
if test is not None:
403402
tests.append(test)
404403

405-
if sys.version_info < (3, 13):
406-
407-
def _from_module(
408-
self,
409-
module: str | types.ModuleType | None,
410-
object: object, # NOQA: A002
411-
) -> bool:
412-
"""Return true if the given object lives in the given module.
413-
414-
`cached_property` objects are never considered a part
415-
of the 'current module'. As such they are skipped by doctest.
416-
Here we override `_from_module` to check the underlying
417-
function instead. https://github.com/python/cpython/issues/107995.
418-
"""
419-
if isinstance(object, functools.cached_property):
420-
object = object.func # noqa: A001
421-
422-
# Type ignored because this is a private function.
423-
return t.cast(
424-
"bool",
425-
super()._from_module(module, object), # type:ignore[misc]
426-
)
427-
428-
else: # pragma: no cover
429-
pass
430-
431404
def _get_test(
432405
self,
433406
string: str,

0 commit comments

Comments
 (0)