summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2023-09-12 14:13:45 (GMT)
committerGitHub <noreply@github.com>2023-09-12 14:13:45 (GMT)
commit5e917a0b09dbd86cff88b04501898e72ade574d5 (patch)
tree876e02f61eedca935688b0c3f80bcf7c0df03b50
parentdf64210ad0d65e82449bbff2c5125764d49e5073 (diff)
downloadcpython-5e917a0b09dbd86cff88b04501898e72ade574d5.zip
cpython-5e917a0b09dbd86cff88b04501898e72ade574d5.tar.gz
cpython-5e917a0b09dbd86cff88b04501898e72ade574d5.tar.bz2
[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 0abc935086931d4915ea3c45cffffecb31e7a45c) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
-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 542fcdb..bca4915 100644
--- a/Lib/test/test_doctest.py
+++ b/Lib/test/test_doctest.py
@@ -740,15 +740,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'