fix(tests): preserve environment in formation subprocess tests to ensure xdist hermeticity

This commit is contained in:
Shay 2026-07-03 17:11:57 -07:00
parent a5f67f95a4
commit c0cd44307a
5 changed files with 10 additions and 5 deletions

View file

@ -10,6 +10,7 @@ Per Phase 3 of ``docs/formation_pipeline_plan.md``:
""" """
from __future__ import annotations from __future__ import annotations
import os
import subprocess import subprocess
import sys import sys
@ -236,7 +237,7 @@ class TestCrossSession:
capture_output=True, capture_output=True,
text=True, text=True,
cwd=str(repo_root), cwd=str(repo_root),
env={"PYTHONHASHSEED": "random", "PATH": ""}, env={**os.environ, "PYTHONHASHSEED": "random", "PATH": ""},
) )
assert result.stdout.strip() == in_proc assert result.stdout.strip() == in_proc

View file

@ -1,6 +1,7 @@
"""Tests for ``formation.templates.composed_relation``.""" """Tests for ``formation.templates.composed_relation``."""
from __future__ import annotations from __future__ import annotations
import os
import subprocess import subprocess
import sys import sys
@ -187,6 +188,6 @@ class TestCrossSession:
[sys.executable, "-c", script], [sys.executable, "-c", script],
check=True, capture_output=True, text=True, check=True, capture_output=True, text=True,
cwd=str(repo_root), cwd=str(repo_root),
env={"PYTHONHASHSEED": "random", "PATH": ""}, env={**os.environ, "PYTHONHASHSEED": "random", "PATH": ""},
) )
assert result.stdout.strip() == in_proc assert result.stdout.strip() == in_proc

View file

@ -1,6 +1,7 @@
"""Tests for ``formation.templates.falsification``.""" """Tests for ``formation.templates.falsification``."""
from __future__ import annotations from __future__ import annotations
import os
import subprocess import subprocess
import sys import sys
@ -132,6 +133,6 @@ class TestCrossSession:
[sys.executable, "-c", script], [sys.executable, "-c", script],
check=True, capture_output=True, text=True, check=True, capture_output=True, text=True,
cwd=str(repo_root), cwd=str(repo_root),
env={"PYTHONHASHSEED": "random", "PATH": ""}, env={**os.environ, "PYTHONHASHSEED": "random", "PATH": ""},
) )
assert result.stdout.strip() == in_proc assert result.stdout.strip() == in_proc

View file

@ -1,6 +1,7 @@
"""Tests for ``formation.templates.identity_anchor``.""" """Tests for ``formation.templates.identity_anchor``."""
from __future__ import annotations from __future__ import annotations
import os
import subprocess import subprocess
import sys import sys
@ -154,6 +155,6 @@ class TestCrossSession:
[sys.executable, "-c", script], [sys.executable, "-c", script],
check=True, capture_output=True, text=True, check=True, capture_output=True, text=True,
cwd=str(repo_root), cwd=str(repo_root),
env={"PYTHONHASHSEED": "random", "PATH": ""}, env={**os.environ, "PYTHONHASHSEED": "random", "PATH": ""},
) )
assert result.stdout.strip() == in_proc assert result.stdout.strip() == in_proc

View file

@ -1,6 +1,7 @@
"""Tests for ``formation.templates.procedural``.""" """Tests for ``formation.templates.procedural``."""
from __future__ import annotations from __future__ import annotations
import os
import subprocess import subprocess
import sys import sys
@ -157,6 +158,6 @@ class TestCrossSession:
[sys.executable, "-c", script], [sys.executable, "-c", script],
check=True, capture_output=True, text=True, check=True, capture_output=True, text=True,
cwd=str(repo_root), cwd=str(repo_root),
env={"PYTHONHASHSEED": "random", "PATH": ""}, env={**os.environ, "PYTHONHASHSEED": "random", "PATH": ""},
) )
assert result.stdout.strip() == in_proc assert result.stdout.strip() == in_proc