mirror of
https://github.com/python/cpython.git
synced 2025-07-23 19:25:40 +00:00
Test DocTestFinder directly instead of calling support.run_doctest() (GH-108917)
This commit is contained in:
parent
c439f6a72d
commit
0abc935086
1 changed files with 3 additions and 5 deletions
|
@ -784,15 +784,13 @@ class TestDocTestFinder(unittest.TestCase):
|
||||||
|
|
||||||
def test_issue35753(self):
|
def test_issue35753(self):
|
||||||
# This import of `call` should trigger issue35753 when
|
# 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.
|
# however with a patched doctest this should succeed.
|
||||||
from unittest.mock import call
|
from unittest.mock import call
|
||||||
dummy_module = types.ModuleType("dummy")
|
dummy_module = types.ModuleType("dummy")
|
||||||
dummy_module.__dict__['inject_call'] = call
|
dummy_module.__dict__['inject_call'] = call
|
||||||
try:
|
finder = doctest.DocTestFinder()
|
||||||
support.run_doctest(dummy_module, verbosity=True)
|
self.assertEqual(finder.find(dummy_module), [])
|
||||||
except ValueError as e:
|
|
||||||
raise support.TestFailed("Doctest unwrap failed") from e
|
|
||||||
|
|
||||||
def test_empty_namespace_package(self):
|
def test_empty_namespace_package(self):
|
||||||
pkg_name = 'doctest_empty_pkg'
|
pkg_name = 'doctest_empty_pkg'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue