$ ./python -m test --coverage test_doctest
Using random seed: 3179682031
0:00:00 load avg: 0.55 Run 1 test sequentially
0:00:00 load avg: 0.55 [1/1] test_doctest
test_doctest passed in 35.7 sec
== Tests result: SUCCESS ==
1 test OK.
Total duration: 35.7 sec
Total tests: run=63
Total test files: run=1/1
Result: SUCCESS
Not printing coverage data for '/tmp/tmpfuj65rqc/doctest_testpkg/__init__.py': [Errno 2] No such file or directory: '/tmp/tmpfuj65rqc/doctest_testpkg/__init__.py'
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/home/sk/src/cpython/Lib/test/__main__.py", line 2, in <module>
main(_add_python_opts=True)
File "/home/sk/src/cpython/Lib/test/libregrtest/main.py", line 665, in main
Regrtest(ns, _add_python_opts=_add_python_opts).main(tests=tests)
File "/home/sk/src/cpython/Lib/test/libregrtest/main.py", line 657, in main
exitcode = self.run_tests(selected, tests)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/sk/src/cpython/Lib/test/libregrtest/main.py", line 494, in run_tests
return self._run_tests(selected, tests)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/sk/src/cpython/Lib/test/libregrtest/main.py", line 474, in _run_tests
self.finalize_tests(tracer)
File "/home/sk/src/cpython/Lib/test/libregrtest/main.py", line 374, in finalize_tests
results.write_results(show_missing=True, summary=True,
File "/home/sk/src/cpython/Lib/trace.py", line 273, in write_results
with open(filename, 'rb') as fp:
^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmpfuj65rqc/doctest_testpkg/__init__.py'
After removing problem doctest
Details
diff --git a/Lib/test/test_doctest.py b/Lib/test/test_doctest.py
index 6a903ed041..55c413d183 100644
--- a/Lib/test/test_doctest.py+++ b/Lib/test/test_doctest.py@@ -2851,31 +2851,6 @@ def test_lineendings(): r"""
at least one of the line endings will raise a ValueError for inconsistent
whitespace if doctest does not correctly do the newline conversion.
- >>> from test.support import os_helper- >>> import shutil- >>> dn = tempfile.mkdtemp()- >>> pkg = os.path.join(dn, "doctest_testpkg")- >>> os.mkdir(pkg)- >>> os_helper.create_empty_file(os.path.join(pkg, "__init__.py"))- >>> fn = os.path.join(pkg, "doctest_testfile.txt")- >>> with open(fn, 'wb') as f:- ... f.write(- ... b'Test:\r\n\r\n'- ... b' >>> x = 1 + 1\r\n\r\n'- ... b'Done.\r\n'- ... b'Test:\n\n'- ... b' >>> x = 1 + 1\n\n'- ... b'Done.\n'- ... b'Test:\r\r'- ... b' >>> x = 1 + 1\r\r'- ... b'Done.\r'- ... )- 95- >>> with test_hook(dn):- ... doctest.testfile("doctest_testfile.txt", package="doctest_testpkg", verbose=False)- TestResults(failed=0, attempted=3)- >>> shutil.rmtree(dn)-
"""
def test_testmod(): r"""
Activity
gaogaotiantian commented on Feb 4, 2024
I think this is fixed so maybe we can close the issue now?
skirpichev commented on Feb 4, 2024
Yeah, I can't reproduce this in the current main.