Commit Graph

6 Commits

Author SHA1 Message Date
Alex Waygood 3b9d10b031
gh-109413: libregrtest: Add and improve type annotations (#109405) 2023-09-14 18:33:18 +00:00
Victor Stinner 4e77645986
gh-109276: libregrtest only checks saved_test_environment() once (#109278)
There is no need to check for environment changes twice.
2023-09-12 05:01:33 +02:00
Victor Stinner de5f8f7d13
gh-109276: libregrtest: use separated file for JSON (#109277)
libregrtest now uses a separated file descriptor to write test result
as JSON.  Previously, if a test wrote debug messages late around the
JSON, the main test process failed to parse JSON.

Rename TestResult.write_json() to TestResult.write_json_into().

worker_process() no longer writes an empty line at the end. There is
no need to separate test process output from the JSON output anymore,
since JSON is now written into a separated file descriptor.

create_worker_process() now always spawn the process with
close_fds=True.
2023-09-11 19:33:42 +02:00
Victor Stinner 7aa8fcc8eb
gh-109162: libregrtest: use relative imports (#109250)
libregrtest.__init__ no longer exposes any symbol, so
"python -m test.libregrtest.worker" imports less modules.
2023-09-11 07:02:35 +00:00
Victor Stinner 0c139b5f2f
gh-109162: libregrtest: rename runtest_mp.py to run_workers.py (#109248)
* Rename runtest_mp.py to run_workers.py
* Move exit_timeout() and temp_cwd() context managers from
  Regrtest.main() to Regrtest.run_tests(). Actions like --list-tests
  or --list-cases don't need these protections.
* Regrtest: remove selected and tests attributes. Pass 'selected' to
  list_tests(), list_cases() and run_tests(). display_result() now
  expects a TestTuple, instead of TestList.
* Rename setup_tests() to setup_process() and rename setup_support()
  to setup_tests().
* Move _adjust_resource_limits() to utils and rename it to
  adjust_rlimit_nofile().
* Move replace_stdout() to utils.
* Fix RunTests.verbose type: it's an int.
2023-09-11 03:27:37 +00:00
Victor Stinner 1ec45378e9
gh-109162: libregrtest: add single.py and result.py (#109243)
* Add single.py and result.py files.
* Rename runtest.py to runtests.py.
* Move run_single_test() function and its helper functions to
  single.py.
* Move remove_testfn(), abs_module_name() and normalize_test_name()
  to utils.py.
* Move setup_support() to setup.py.
* Move type hints like TestName to utils.py.
* Rename runtest.py to runtests.py.
2023-09-11 00:07:18 +00:00