summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2023-09-11 11:03:30 (GMT)
committerGitHub <noreply@github.com>2023-09-11 11:03:30 (GMT)
commit0abc935086931d4915ea3c45cffffecb31e7a45c (patch)
tree8d6a80efa9345d76de9440c6dcf463e2813871c2
parentc439f6a72d828a55aa373fd42c8a0ef771e303cd (diff)
downloadcpython-0abc935086931d4915ea3c45cffffecb31e7a45c.zip
cpython-0abc935086931d4915ea3c45cffffecb31e7a45c.tar.gz
cpython-0abc935086931d4915ea3c45cffffecb31e7a45c.tar.bz2
Test DocTestFinder directly instead of calling support.run_doctest() (GH-108917)
-rw-r--r--Lib/test/test_doctest.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/Lib/test/test_doctest.py b/Lib/test/test_doctest.py
index 9cc460c..6e12e82 100644
--- a/Lib/test/test_doctest.py
+++ b/Lib/test/test_doctest.py
@@ -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'