]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Test DocTestFinder directly instead of calling support.run_doctest() (GH-108917)
authorSerhiy Storchaka <storchaka@gmail.com>
Mon, 11 Sep 2023 11:03:30 +0000 (14:03 +0300)
committerGitHub <noreply@github.com>
Mon, 11 Sep 2023 11:03:30 +0000 (14:03 +0300)
Lib/test/test_doctest.py

index 9cc460c8b913f6af87b547b5c01d1b510cdbabc3..6e12e82a7a008411ca5f0c01a3925d126e539013 100644 (file)
@@ -784,15 +784,13 @@ class TestDocTestFinder(unittest.TestCase):
 
     def test_issue35753(self):
         # This import of `call` should trigger issue35753 when
-        # `support.run_doctest` is called due to unwrap failing,
+        # DocTestFinder.find() is called due to inspect.unwrap() failing,
         # however with a patched doctest this should succeed.
         from unittest.mock import call
         dummy_module = types.ModuleType("dummy")
         dummy_module.__dict__['inject_call'] = call
-        try:
-            support.run_doctest(dummy_module, verbosity=True)
-        except ValueError as e:
-            raise support.TestFailed("Doctest unwrap failed") from e
+        finder = doctest.DocTestFinder()
+        self.assertEqual(finder.find(dummy_module), [])
 
     def test_empty_namespace_package(self):
         pkg_name = 'doctest_empty_pkg'