https://github.com/python/cpython/commit/f84083b08ab40b08c8d608a320008418b331932e
commit: f84083b08ab40b08c8d608a320008418b331932e
branch: main
author: Victor Stinner <[email protected]>
committer: vstinner <[email protected]>
date: 2026-11-20T00:42:03+01:00
summary:

Fix regrtest rerun: reset worker_bug (#162293)

When a test fails with "worker bug" and tests are rerun in verbose
mode, reset worker_bug so that tests are marked as success if the
failed test doesn't fail again when rerun in verbose mode.

TestResult.write_json_into(file) now calls also file.flush().

files:
M Lib/test/libregrtest/result.py
M Lib/test/libregrtest/results.py

diff --git a/Lib/test/libregrtest/result.py b/Lib/test/libregrtest/result.py
index f8aa256be1ecfe..ba4ba4d13ea1d7 100644
--- a/Lib/test/libregrtest/result.py
+++ b/Lib/test/libregrtest/result.py
@@ -226,6 +226,7 @@ def get_rerun_match_tests(self) -> FilterTuple | None:
 
     def write_json_into(self, file) -> None:
         json.dump(self, file, cls=_EncodeTestResult)
+        file.flush()
 
     @staticmethod
     def from_json(worker_json: StrJSON) -> 'TestResult':
diff --git a/Lib/test/libregrtest/results.py b/Lib/test/libregrtest/results.py
index eac8f4c40ebca1..c57b82e05a5b21 100644
--- a/Lib/test/libregrtest/results.py
+++ b/Lib/test/libregrtest/results.py
@@ -168,6 +168,7 @@ def prepare_rerun(self, *, clear: bool = True) -> 
tuple[TestTuple, FilterDict]:
             self.bad.clear()
             self.env_changed.clear()
             self.rerun_results.clear()
+            self.worker_bug = False
 
         return (tuple(tests), match_tests_dict)
 

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to