gh-109162: libregrtest: add worker.py (#109229)

Add new worker.py file:

* Move create_worker_process() and worker_process() to this file.
* Add main() function to worker.py. create_worker_process() now
  runs the command: "python -m test.libregrtest.worker JSON".
* create_worker_process() now starts the worker process in the
  current working directory. Regrtest now gets the absolute path of
  the reflog.txt filename: -R command line option filename.
* Remove --worker-json command line option.
  Remove test_regrtest.test_worker_json().

Related changes:

* Add write_json() and from_json() methods to TestResult.
* Rename select_temp_dir() to get_temp_dir() and move it to utils.
* Rename make_temp_dir() to get_work_dir() and move it to utils.
  It no longer calls os.makedirs(): Regrtest.main() now calls it.
* Move fix_umask() to utils. The function is now called by
  setup_tests().
* Move StrPath to utils.
* Add exit_timeout() context manager to utils.
* RunTests: Replace junit_filename (StrPath) with use_junit (bool).
This commit is contained in:
Victor Stinner 2023-09-11 01:11:22 +02:00 committed by GitHub
parent e55aab9578
commit a939b65aa6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 238 additions and 213 deletions

View file

@ -75,11 +75,6 @@ class ParseArgsTestCase(unittest.TestCase):
ns = libregrtest._parse_args(['--wait'])
self.assertTrue(ns.wait)
def test_worker_json(self):
ns = libregrtest._parse_args(['--worker-json', '[[], {}]'])
self.assertEqual(ns.worker_json, '[[], {}]')
self.checkError(['--worker-json'], 'expected one argument')
def test_start(self):
for opt in '-S', '--start':
with self.subTest(opt=opt):