[New-bugs-announce] [issue22002] Make full use of test discovery in test subpackages

Zachary Ware report at bugs.python.org
Thu Jul 17 22:09:20 CEST 2014


New submission from Zachary Ware:

Here's a patch against 3.4 implementing Serhiy's suggestion in msg223277 and taking it a step further, actually using test discovery in all of the test.test_* subpackages.

To reduce duplication, the patch adds a 'load_package_tests' function to test.support, which is then used in each of the subpackages' load_tests function.

test_json and test_tools should have no visible changes from this patch.  test_asyncio and test_email do have slight differences, but only in verbosity level: pre-patch, `python -m test.test_(asyncio|email)` runs at verbosity=2 (support.run_unittest default); with patch, they run at verbosity=1 (unittest default).  test_asyncio also reports one more skipped test on Windows, due to a module that raises SkipTest on import.

@Brett: test_importlib sees the most changes, and I'd like to be sure that things are as you expect them to be.  It looks like all of the test_suite() stuff is unused leftovers from when "test_importlib" was "importlib.test" and that test_importlib has actually been relying on unittest discovery (but bypassing load_tests and thereby not working with `python -m unittest test.test_importlib`), but I'd like confirmation on that.

A nice bonus with this patch is that (for example) `python -m test.test_importlib.source` works, testing just the named test_importlib subpackage.

----------
components: Tests
files: package_discovery.diff
keywords: patch
messages: 223366
nosy: berker.peksag, brett.cannon, ezio.melotti, serhiy.storchaka, zach.ware
priority: normal
severity: normal
stage: patch review
status: open
title: Make full use of test discovery in test subpackages
type: enhancement
versions: Python 3.4, Python 3.5
Added file: http://bugs.python.org/file35987/package_discovery.diff

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22002>
_______________________________________


More information about the New-bugs-announce mailing list