-
-
Notifications
You must be signed in to change notification settings - Fork 31k
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
Always use unittest for collecting tests in regrtests #89392
Comments
Currently regrtest supports two ways of collecting and running tests in module.
The disadvantage of the former way is that new test classes should be added manually to the list. If you forget to do this, new tests will not be run. See for example bpo-45185 and bpo-45187. Not runned tests can hide bugs. So it would be better to eliminate human factor and detect tests automatically. |
PR 28405 contains simple changes for 60 test files. It does not cover files which use complex code for generating list of test classes and running doctests (because there are subtle differences between running doctests with run_doctest() and via DocTestSuite). They are left for the following PRs. |
See also bpo-16748 |
Thank you Zachary, I almost forgot about that issue. The goal of this issue is to make regrtests using test discovery instead of manually composed lists of test classes. Of course it requires that tests should be discoverable. And most of them already are, thanks to bpo-16748 and similar. |
Thank you for doing this. When I started setting up the IDLE test suite 8 years ago, I was a bit confused about the mixture of old ways (test_main) and new ways (unittest.main and possibly load_tests) in the test suite. Fortunately, Nick C. told me which was which. Updating the test suite should make it better as an example for new unittest users. |
Unfortunately, this PR28615 seems to have broken a bunch of buildbots. For instance: https://buildbot.python.org/all/#/builders/75/builds/172/steps/5/logs/stdio
|
Seems this is not a new bug: $ ./python -m test test_datetime test_datetime -m test_divide_and_round
0:00:00 load avg: 2.36 Run tests sequentially
0:00:00 load avg: 2.36 [1/2] test_datetime
0:00:00 load avg: 2.36 [2/2] test_datetime
test test_datetime failed -- Traceback (most recent call last):
File "/home/serhiy/py/cpython3.9/Lib/test/datetimetester.py", line 88, in test_divide_and_round
dar = datetime_module._divide_and_round
AttributeError: module 'datetime' has no attribute '_divide_and_round' test_datetime failed (1 error) == Tests result: FAILURE == But for some causes it was not reproduced with refleak tests. |
I agree, is unfortunate. But sadly is breaking all buildbots and therefore is hiding other issues and making the 'test-with-buildbots' label not useful. I would prefer to revert until we have a fix (and not land the backports until then). |
…ythonGH-108876). (cherry picked from commit 04a0830) Co-authored-by: Serhiy Storchaka <[email protected]>
…GH-108877) (cherry picked from commit f3b6608) Co-authored-by: Serhiy Storchaka <[email protected]>
) (#108897) [3.12] gh-89392: Remove support of test_main() in libregrtest (GH-108876). (cherry picked from commit 04a0830) Co-authored-by: Alex Waygood <[email protected]>
…GH-108911) (cherry picked from commit eaabaac) Co-authored-by: Serhiy Storchaka <[email protected]>
…GH-108911) (cherry picked from commit eaabaac) Co-authored-by: Serhiy Storchaka <[email protected]>
…8911) (GH-108914) (cherry picked from commit eaabaac) Co-authored-by: Serhiy Storchaka <[email protected]>
…ythonGH-108916) (cherry picked from commit f980cc1) Co-authored-by: Serhiy Storchaka <[email protected]>
…ythonGH-108916) (cherry picked from commit f980cc1) Co-authored-by: Serhiy Storchaka <[email protected]>
…GH-108916) (GH-108920) (cherry picked from commit f980cc1) Co-authored-by: Serhiy Storchaka <[email protected]>
…GH-108916) (#108919) gh-89392: Use unittest test runner for doctests in test_getopt (GH-108916) (cherry picked from commit f980cc1) Co-authored-by: Serhiy Storchaka <[email protected]>
Finally it has been finished. |
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:
Linked PRs
The text was updated successfully, but these errors were encountered: