[New-bugs-announce] [issue30683] Enhance doctest support in regrtest --list-cases
STINNER Victor
report at bugs.python.org
Fri Jun 16 07:40:34 EDT 2017
New submission from STINNER Victor:
bpo-30523 added a new --list-cases command to regrtest to list test methods. It is able to list doctest tests in test_builtins, but not in test_extcall.
test_builtin doctest tests:
haypo at selma$ ./python -m test test_builtin --list-cases|grep ^builtins
builtins.bin
builtins.float.as_integer_ratio
...
test_builtins works because it uses:
def load_tests(loader, tests, pattern):
from doctest import DocTestSuite
tests.addTest(DocTestSuite(builtins))
return tests
Listing test methods of test_extcall doesn't work, the following command has no output (but succeed):
./python -m test test_extcall --list-cases
test_extcall uses:
def test_main():
support.run_doctest(sys.modules[__name__], True)
I see two options:
* Replace support.run_doctest() with doctest.DocTestSuite() in all tests
* Enhance --list-cases to discover doctests. support.run_doctest() calls doctest.testmod(), but doctest.testmod() has no API to list tests. testmod() lists tests and directly runs them. Maybe --list-cases can reuse doctest.DocTestSuite(), I don't know.
----------
components: Tests
messages: 296179
nosy: haypo
priority: normal
severity: normal
status: open
title: Enhance doctest support in regrtest --list-cases
type: enhancement
versions: Python 3.7
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30683>
_______________________________________
More information about the New-bugs-announce
mailing list