PythonPackage: run test_imports in run env context

This commit is contained in:
Wouter Deconinck 2025-01-03 19:30:48 -06:00 committed by GitHub
parent 0a03a92e78
commit d4a28b4e22
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -19,6 +19,7 @@
import spack.builder
import spack.config
import spack.context
import spack.deptypes as dt
import spack.detection
import spack.multimethod
@ -237,7 +238,12 @@ def test_imports(self) -> None:
purpose=f"checking import of {module}",
work_dir="spack-test",
):
python("-c", f"import {module}")
setup_context = spack.build_environment.SetupContext(
self.spec, context=spack.context.Context.RUN
)
mods = setup_context.get_env_modifications()
with mods.set_env():
python("-c", f"import {module}")
def update_external_dependencies(self, extendee_spec=None):
"""