From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Mon, 11 Sep 2023 11:30:24 +0000 (-0700) Subject: [3.11] Test DocTestFinder directly instead of calling support.run_doctest() (GH-10891... X-Git-Tag: v3.11.6~105 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=74988a47e770095620f6199a69cebe06a55020b2;p=thirdparty%2FPython%2Fcpython.git [3.11] Test DocTestFinder directly instead of calling support.run_doctest() (GH-108917) (GH-109260) (cherry picked from commit 0abc935086931d4915ea3c45cffffecb31e7a45c) Co-authored-by: Serhiy Storchaka --- diff --git a/Lib/test/test_doctest.py b/Lib/test/test_doctest.py index 00aeacddc12c..e48d91fafeda 100644 --- a/Lib/test/test_doctest.py +++ b/Lib/test/test_doctest.py @@ -742,15 +742,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'