From 10304436735ae9dd1233977542bb7c7496190040 Mon Sep 17 00:00:00 2001 From: Kyle Knoepfel Date: Tue, 27 Oct 2026 04:30:02 -0500 Subject: [PATCH 1/2] fix: isolate Spack setup test from inherited Bash function --- scripts/test/test_devcontainer_host.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/test/test_devcontainer_host.py b/scripts/test/test_devcontainer_host.py index 18e00decb..4cf6b3b29 100644 --- a/scripts/test/test_devcontainer_host.py +++ b/scripts/test/test_devcontainer_host.py @@ -792,6 +792,8 @@ def test_setup_spack_environment_sources_spack_root_when_command_is_missing(tmp_ env = { key: value for key, value in os.environ.items() if not key.startswith(("PHLEX_", "SPACK_")) } + # Remove the inherited Spack function so restricting PATH makes spack unavailable. + env.pop("BASH_FUNC_spack%%", None) env.update(SPACK_ROOT=str(tmp_path), PATH="/usr/bin:/bin") result = subprocess.run( ["bash", "-c", command_script, "bash", str(fixture)], From 5d9fd8c1662118dc2277229e21986e5a4218d2e2 Mon Sep 17 00:00:00 2001 From: Kyle Knoepfel Date: Thu, 29 Oct 2026 07:50:50 -0500 Subject: [PATCH 2/2] chore: clean-up per @greenc-FNAL --- scripts/test/test_devcontainer_host.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/test/test_devcontainer_host.py b/scripts/test/test_devcontainer_host.py index 4cf6b3b29..6ed22182e 100644 --- a/scripts/test/test_devcontainer_host.py +++ b/scripts/test/test_devcontainer_host.py @@ -782,6 +782,7 @@ def test_setup_spack_environment_sources_spack_root_when_command_is_missing(tmp_ fixture.write_text(definitions) command_script = "\n".join( ( + "unset -f spack", 'source "$1"', '[[ -n "${SPACK_ROOT:-}" ]]', "if command -v spack >/dev/null 2>&1; then exit 99; fi", @@ -792,8 +793,6 @@ def test_setup_spack_environment_sources_spack_root_when_command_is_missing(tmp_ env = { key: value for key, value in os.environ.items() if not key.startswith(("PHLEX_", "SPACK_")) } - # Remove the inherited Spack function so restricting PATH makes spack unavailable. - env.pop("BASH_FUNC_spack%%", None) env.update(SPACK_ROOT=str(tmp_path), PATH="/usr/bin:/bin") result = subprocess.run( ["bash", "-c", command_script, "bash", str(fixture)],