8000 [3.11] Test DocTestFinder directly instead of calling support.run_doc… · python/cpython@74988a4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 74988a4

Browse files
[3.11] Test DocTestFinder directly instead of calling support.run_doctest() (GH-108917) (GH-109260)
(cherry picked from commit 0abc935) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
1 parent 2f8c80f commit 74988a4

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

Lib/test/test_doctest.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -742,15 +742,13 @@ class TestDocTestFinder(unittest.TestCase):
742742

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

755753
def test_empty_namespace_package(self):
756754
pkg_name = 'doctest_empty_pkg'

0 commit comments

Comments
 (0)
0