Skip to content

Test DocTestFinder directly instead of calling support.run_doctest() #108917

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions Lib/test/test_doctest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down