Author vstinner
Recipients vstinner
Date 2017-06-16.11:40:34
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1497613234.61.0.125565868386.issue30683@psf.upfronthosting.co.za>
In-reply-to
Content
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@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.
History
Date User Action Args
2017-06-16 11:40:34vstinnersetrecipients: + vstinner
2017-06-16 11:40:34vstinnersetmessageid: <1497613234.61.0.125565868386.issue30683@psf.upfronthosting.co.za>
2017-06-16 11:40:34vstinnerlinkissue30683 messages
2017-06-16 11:40:34vstinnercreate