Skip to content

Commit

Permalink
pythongh-111348: Do not allow test_doctest to be run directly, remo…
Browse files Browse the repository at this point in the history
…ve `test_coverage`
  • Loading branch information
sobolevn authored Oct 26, 2023
1 parent 34ddcc3 commit 63b1f95
Showing 1 changed file with 4 additions and 15 deletions.
19 changes: 4 additions & 15 deletions Lib/test/test_doctest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3218,19 +3218,8 @@ def load_tests(loader, tests, pattern):
return tests


def test_coverage(coverdir):
trace = import_helper.import_module('trace')
tracer = trace.Trace(ignoredirs=[sys.base_prefix, sys.base_exec_prefix,],
trace=0, count=1)
tracer.run('test_main()')
r = tracer.results()
print('Writing coverage results...')
r.write_results(show_missing=True, summary=True,
coverdir=coverdir)


if __name__ == '__main__':
if '-c' in sys.argv:
test_coverage('/tmp/doctest.cover')
else:
unittest.main()
raise RuntimeError(

This comment has been minimized.

Copy link
@terryjreedy

terryjreedy Oct 26, 2023

This seems premature to me; see issue comment.

"Running `test_doctest` via cmdline is not supported, "
"use `-m test test_doctest` instead"
)

0 comments on commit 63b1f95

Please sign in to comment.