Skip to content

Commit 746db3b

Browse files
committed
tests: make regression subprocess execution deterministic
1 parent 7a23d42 commit 746db3b

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

‎tests/regression/helpers.py‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,12 +367,25 @@ def run_codeentropy_with_config(*, workdir: Path, config_src: Path) -> RunResult
367367

368368
(workdir / "config.yaml").write_text(yaml.safe_dump(cooked, sort_keys=False))
369369

370+
env = os.environ.copy()
371+
env.update(
372+
{
373+
"PYTHONHASHSEED": "0",
374+
"OMP_NUM_THREADS": "1",
375+
"OPENBLAS_NUM_THREADS": "1",
376+
"MKL_NUM_THREADS": "1",
377+
"NUMEXPR_NUM_THREADS": "1",
378+
"BLIS_NUM_THREADS": "1",
379+
"VECLIB_MAXIMUM_THREADS": "1",
380+
}
381+
)
382+
370383
proc = subprocess.run(
371384
[sys.executable, "-m", "CodeEntropy"],
372385
cwd=str(workdir),
373386
capture_output=True,
374387
text=True,
375-
env={**os.environ},
388+
env=env,
376389
)
377390

378391
(workdir / "codeentropy_stdout.txt").write_text(proc.stdout or "")

0 commit comments

Comments
 (0)