Skip to content

Commit 5e917a0

Browse files
[3.12] Test DocTestFinder directly instead of calling support.run_doctest() (GH-108917) (#109259)
Test DocTestFinder directly instead of calling support.run_doctest() (GH-108917) (cherry picked from commit 0abc935) Co-authored-by: Serhiy Storchaka <[email protected]>
1 parent df64210 commit 5e917a0

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

Lib/test/test_doctest.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -740,15 +740,13 @@ class TestDocTestFinder(unittest.TestCase):
740740

741741
def test_issue35753(self):
742742
# This import of `call` should trigger issue35753 when
743-
# `support.run_doctest` is called due to unwrap failing,
743+
# DocTestFinder.find() is called due to inspect.unwrap() failing,
744744
# however with a patched doctest this should succeed.
745745
from unittest.mock import call
746746
dummy_module = types.ModuleType("dummy")
747747
dummy_module.__dict__['inject_call'] = call
748-
try:
749-
support.run_doctest(dummy_module, verbosity=True)
750-
except ValueError as e:
751-
raise support.TestFailed("Doctest unwrap failed") from e
748+
finder = doctest.DocTestFinder()
749+
self.assertEqual(finder.find(dummy_module), [])
752750

753751
def test_empty_namespace_package(self):
754752
pkg_name = 'doctest_empty_pkg'

0 commit comments

Comments
 (0)