Skip to content

Commit dd1194e

Browse files
gh-109817: Do not copy all test cases into the worker process (GH-155713)
With --single-process-per-case, tests and case_groups contain all test cases of the whole run. Copying them for every test case was slow and could produce a too long command line. The worker needs neither.
1 parent ceb3518 commit dd1194e

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

Lib/test/libregrtest/runtests.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,10 @@ def copy(self, **override) -> 'RunTests':
110110
return RunTests(**state)
111111

112112
def create_worker_runtests(self, **override) -> WorkerRunTests:
113-
state = dataclasses.asdict(self)
113+
# Drop the large fields *before* converting: asdict() copies them
114+
# deeply, which is expensive when the whole run has many cases.
115+
state = dataclasses.asdict(
116+
dataclasses.replace(self, tests=(), case_groups=None))
114117
state.update(override)
115118
return WorkerRunTests(**state)
116119

0 commit comments

Comments
 (0)