]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.12] gh-108822: regrtest computes statistics (#108793) (#108833)
authorVictor Stinner <vstinner@python.org>
Mon, 4 Sep 2023 11:45:50 +0000 (13:45 +0200)
committerGitHub <noreply@github.com>
Mon, 4 Sep 2023 11:45:50 +0000 (13:45 +0200)
commitc8cf6be213826c8d0e3e2acbcf31b8c1069df3ed
tree55753776b33bed0d96f02e3f763379e482c14e49
parentdcaacd906638edbc66cc84fa651163dc7a743070
[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 d4e534cbb35678c82b3a1276826af55d7bfc23b6)
Lib/test/libregrtest/main.py
Lib/test/libregrtest/refleak.py
Lib/test/libregrtest/runtest.py
Lib/test/libregrtest/runtest_mp.py
Lib/test/libregrtest/save_env.py
Lib/test/support/__init__.py
Lib/test/test_netrc.py
Lib/test/test_pep646_syntax.py
Lib/test/test_regrtest.py
Lib/test/test_xml_etree.py