Repository navigation
Always use unittest for collecting tests in regrtests #89392
Description
Activity
Currently regrtest supports two ways of collecting and running tests in module.
-
If the module contains the "test_main" function, regrtest just calls it. This function usually calls run_unittest() with a list of test classes, composed manually, it can also run doctests with run_doctest(), generate list of test classes dynamically, and run some code before and after running tests.
-
Otherwise regrtest uses unittest for for collecting tests.
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.
-
- added3.9 (EOL)end of lifeend of life3.10 (EOL)end of lifeend of life3.11only security fixesonly security fixes
on Sep 17, 2021 - added3.10 (EOL)end of lifeend of lifetestsTests in the Lib/test dirTests in the Lib/test dirtype-featureA feature request or enhancementA feature request or enhancement3.11only security fixesonly security fixes
on Sep 17, 2021 - addedtestsTests in the Lib/test dirTests in the Lib/test dirtype-featureA feature request or enhancementA feature request or enhancement
on Sep 17, 2021 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
67 remaining items
- added 3 commits that reference this issue
on Sep 5, 2023 - added a commit that references this issue
on Sep 5, 2023 Finally it has been finished.
Reacted by Alex Waygood
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