Skip to content

Commit 11faa17

Browse files
committed
test.py: sort tests by time and use chunksize=1
1 parent 0e18514 commit 11faa17

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

tests/__init__.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,20 @@ def run(test: Test) -> TestResult:
223223
time = timedelta(seconds=end - start)
224224
return TestResult(test=test, passed=passed, time=time)
225225

226-
# with ThreadPoolExecutor() as executor:
227-
# results = executor.map(run, tests)
228-
results = [run(test) for test in tests]
226+
times = {
227+
"curl": timedelta(minutes=3, seconds=26),
228+
"json-c": timedelta(seconds=23),
229+
"libxml2": timedelta(minutes=1, seconds=39),
230+
"lua": timedelta(seconds=37),
231+
"nginx": timedelta(minutes=1, seconds=18),
232+
"python2": timedelta(minutes=3, seconds=56),
233+
"zstd": timedelta(seconds=47),
234+
}
235+
# run longer tests first
236+
tests.sort(key=lambda test: -times[test.name])
237+
238+
with ThreadPoolExecutor() as executor:
239+
results = executor.map(run, tests, chunksize=1)
229240

230241
for result in results:
231242
print(f"{result.test.name} took {result.time}")

0 commit comments

Comments
 (0)