mirror of
https://github.com/python/cpython.git
synced 2025-11-03 03:22:27 +00:00
gh-108303: Move all doctest related files and tests to Lib/test/test_doctest/ (#112109)
Co-authored-by: Brett Cannon <brett@python.org>
This commit is contained in:
parent
2ff072f21f
commit
9c93350f58
18 changed files with 153 additions and 117 deletions
|
|
@ -29,8 +29,9 @@ verbose = test.support.verbose
|
|||
# test_cmd_line_script (covers the zipimport support in runpy)
|
||||
|
||||
# Retrieve some helpers from other test cases
|
||||
from test import (test_doctest, sample_doctest, sample_doctest_no_doctests,
|
||||
sample_doctest_no_docstrings)
|
||||
from test.test_doctest import (test_doctest,
|
||||
sample_doctest, sample_doctest_no_doctests,
|
||||
sample_doctest_no_docstrings)
|
||||
|
||||
|
||||
def _run_object_doctest(obj, module):
|
||||
|
|
@ -100,18 +101,18 @@ class ZipSupportTests(unittest.TestCase):
|
|||
# everything still works correctly
|
||||
test_src = inspect.getsource(test_doctest)
|
||||
test_src = test_src.replace(
|
||||
"from test import test_doctest",
|
||||
"from test.test_doctest import test_doctest",
|
||||
"import test_zipped_doctest as test_doctest")
|
||||
test_src = test_src.replace("test.test_doctest",
|
||||
test_src = test_src.replace("test.test_doctest.test_doctest",
|
||||
"test_zipped_doctest")
|
||||
test_src = test_src.replace("test.sample_doctest",
|
||||
test_src = test_src.replace("test.test_doctest.sample_doctest",
|
||||
"sample_zipped_doctest")
|
||||
# The sample doctest files rewritten to include in the zipped version.
|
||||
sample_sources = {}
|
||||
for mod in [sample_doctest, sample_doctest_no_doctests,
|
||||
sample_doctest_no_docstrings]:
|
||||
src = inspect.getsource(mod)
|
||||
src = src.replace("test.test_doctest", "test_zipped_doctest")
|
||||
src = src.replace("test.test_doctest.test_doctest", "test_zipped_doctest")
|
||||
# Rewrite the module name so that, for example,
|
||||
# "test.sample_doctest" becomes "sample_zipped_doctest".
|
||||
mod_name = mod.__name__.split(".")[-1]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue