New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make full use of test discovery in test subpackages #66201
Comments
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, @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 A nice bonus with this patch is that (for example) |
I can confirm everything you said is accurate, Zachary. And I very much look forward to the results of the patch. =) |
I have no problem with the change to test_email. (I could have sworn I tried unittest.main() in __main__ when I set it up, but I must have screwed something up). I didn't go over the patch line by line, but it looks good to me. |
I'm getting lost in all the enhancement requests for tests. How does this relate to e.g. 16748 or 10572? |
Victor, could you give me a yay or nay on the test_asyncio change? |
Nice. Could you please comment multiple dirname()-s in load_package_tests() as it done for basename in Lib/test/test_tools/init.py? |
New changeset 4f9f7e0fe1fd by Zachary Ware in branch '3.4': New changeset 6298895a52de by Zachary Ware in branch 'default': |
Committed with a couple of changes from the posted patch: commented on the multiple dirname() calls as Serhiy suggested, removed the 'with DirsOnSysPath():' line since it turns out to be unnecessary when supplying top_level_dir to loader.discover(), and added some documentation for the new function to Doc/library/test.rst. Victor, I went ahead and did the change to test_asyncio since it looks like the tulip project test package doesn't actually have __init__.py or __main__.py, and thus should be no conflict. Please correct me if I'm wrong on that. Thanks for the reviews! |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: