cpython/Lib/test/libregrtest
Victor Stinner c8cf6be213
[3.12] gh-108822: regrtest computes statistics (#108793) (#108833)
gh-108822: regrtest computes statistics (#108793)

test_netrc, test_pep646_syntax and test_xml_etree now return results
in the test_main() function.

Changes:

* Rewrite TestResult as a dataclass with a new State class.
* Add test.support.TestStats class and Regrtest.stats_dict attribute.
* libregrtest.runtest functions now modify a TestResult instance
  in-place.
* libregrtest summary lists the number of run tests and skipped
  tests, and denied resources.
* Add TestResult.has_meaningful_duration() method.
* Compute TestResult duration in the upper function.
* Use time.perf_counter() instead of time.monotonic().
* Regrtest: rename 'resource_denieds' attribute to 'resource_denied'.
* Rename CHILD_ERROR to MULTIPROCESSING_ERROR.
* Use match/case syntadx to have different code depending on the
  test state.

Notes on the backport: doctest.TestResults.skipped is a new feature
in Python 3.13, so don't use it in the backport.

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
(cherry picked from commit d4e534cbb3)
2023-09-04 13:45:50 +02:00
..
__init__.py bpo-37473: Don't import importlib ASAP in tests (GH-14661) 2019-07-14 19:31:12 +02:00
cmdline.py gh-94052: Don't re-run failed tests with --python option (#94054) 2022-06-21 14:42:32 +02:00
main.py [3.12] gh-108822: regrtest computes statistics (#108793) (#108833) 2023-09-04 13:45:50 +02:00
pgo.py bpo-10572: Fixup Lib/test/libregrtest/pgo.py (GH-29327) 2021-11-01 09:57:28 +00:00
refleak.py [3.12] gh-108822: regrtest computes statistics (#108793) (#108833) 2023-09-04 13:45:50 +02:00
runtest.py [3.12] gh-108822: regrtest computes statistics (#108793) (#108833) 2023-09-04 13:45:50 +02:00
runtest_mp.py [3.12] gh-108822: regrtest computes statistics (#108793) (#108833) 2023-09-04 13:45:50 +02:00
save_env.py [3.12] gh-108822: regrtest computes statistics (#108793) (#108833) 2023-09-04 13:45:50 +02:00
setup.py Run Tools/scripts/reindent.py (#94225) 2022-06-26 10:34:06 +02:00
utils.py gh-103193: Fix refleaks in test_inspect and test_typing (#104320) 2023-05-09 18:03:36 +05:30
win_utils.py bpo-44336: Prevent tests hanging on child process handles on Windows (GH-26578) 2022-03-22 00:06:55 +00:00