Fix coverage race: delete stale .coverage* files before each package test run

Parallel cgroup subprocesses racing on the same .coverage SQLite DB caused
INTERNALERROR (no such table: meta/arc) when combining coverage data files.
Delete all .coverage* files before each package run to prevent corruption.
This commit is contained in:
Krzysztof kuhy Rudnicki 2026-04-12 21:56:46 +02:00
parent 7945d384c5
commit 6008a4034a

View File

@ -95,6 +95,10 @@ def main() -> int:
# instantly at the limit instead of thrashing swap/zram.
use_cgroup = shutil.which("systemd-run") is not None
for pkg in sorted(packages):
# Remove stale .coverage* files before each package run to prevent
# SQLite corruption when combining parallel coverage data files.
for stale in Path().glob(".coverage*"):
stale.unlink(missing_ok=True)
cmd = _build_pytest_command({pkg})
if use_cgroup:
cmd = [