From c0cd44307a6a593f7657699e1a3825a27411a209 Mon Sep 17 00:00:00 2001 From: Shay Date: Fri, 3 Jul 2026 17:11:57 -0700 Subject: [PATCH] fix(tests): preserve environment in formation subprocess tests to ensure xdist hermeticity --- tests/formation/test_compose.py | 3 ++- tests/formation/test_template_composed_relation.py | 3 ++- tests/formation/test_template_falsification.py | 3 ++- tests/formation/test_template_identity_anchor.py | 3 ++- tests/formation/test_template_procedural.py | 3 ++- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/tests/formation/test_compose.py b/tests/formation/test_compose.py index 36b0c0d5..308df8e4 100644 --- a/tests/formation/test_compose.py +++ b/tests/formation/test_compose.py @@ -10,6 +10,7 @@ Per Phase 3 of ``docs/formation_pipeline_plan.md``: """ from __future__ import annotations +import os import subprocess import sys @@ -236,7 +237,7 @@ class TestCrossSession: capture_output=True, text=True, cwd=str(repo_root), - env={"PYTHONHASHSEED": "random", "PATH": ""}, + env={**os.environ, "PYTHONHASHSEED": "random", "PATH": ""}, ) assert result.stdout.strip() == in_proc diff --git a/tests/formation/test_template_composed_relation.py b/tests/formation/test_template_composed_relation.py index 06773604..9da05a74 100644 --- a/tests/formation/test_template_composed_relation.py +++ b/tests/formation/test_template_composed_relation.py @@ -1,6 +1,7 @@ """Tests for ``formation.templates.composed_relation``.""" from __future__ import annotations +import os import subprocess import sys @@ -187,6 +188,6 @@ class TestCrossSession: [sys.executable, "-c", script], check=True, capture_output=True, text=True, cwd=str(repo_root), - env={"PYTHONHASHSEED": "random", "PATH": ""}, + env={**os.environ, "PYTHONHASHSEED": "random", "PATH": ""}, ) assert result.stdout.strip() == in_proc diff --git a/tests/formation/test_template_falsification.py b/tests/formation/test_template_falsification.py index 2a9b3358..71c8d625 100644 --- a/tests/formation/test_template_falsification.py +++ b/tests/formation/test_template_falsification.py @@ -1,6 +1,7 @@ """Tests for ``formation.templates.falsification``.""" from __future__ import annotations +import os import subprocess import sys @@ -132,6 +133,6 @@ class TestCrossSession: [sys.executable, "-c", script], check=True, capture_output=True, text=True, cwd=str(repo_root), - env={"PYTHONHASHSEED": "random", "PATH": ""}, + env={**os.environ, "PYTHONHASHSEED": "random", "PATH": ""}, ) assert result.stdout.strip() == in_proc diff --git a/tests/formation/test_template_identity_anchor.py b/tests/formation/test_template_identity_anchor.py index ebf7cb45..a64a6224 100644 --- a/tests/formation/test_template_identity_anchor.py +++ b/tests/formation/test_template_identity_anchor.py @@ -1,6 +1,7 @@ """Tests for ``formation.templates.identity_anchor``.""" from __future__ import annotations +import os import subprocess import sys @@ -154,6 +155,6 @@ class TestCrossSession: [sys.executable, "-c", script], check=True, capture_output=True, text=True, cwd=str(repo_root), - env={"PYTHONHASHSEED": "random", "PATH": ""}, + env={**os.environ, "PYTHONHASHSEED": "random", "PATH": ""}, ) assert result.stdout.strip() == in_proc diff --git a/tests/formation/test_template_procedural.py b/tests/formation/test_template_procedural.py index efec52df..46cc0b41 100644 --- a/tests/formation/test_template_procedural.py +++ b/tests/formation/test_template_procedural.py @@ -1,6 +1,7 @@ """Tests for ``formation.templates.procedural``.""" from __future__ import annotations +import os import subprocess import sys @@ -157,6 +158,6 @@ class TestCrossSession: [sys.executable, "-c", script], check=True, capture_output=True, text=True, cwd=str(repo_root), - env={"PYTHONHASHSEED": "random", "PATH": ""}, + env={**os.environ, "PYTHONHASHSEED": "random", "PATH": ""}, ) assert result.stdout.strip() == in_proc