-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Environment context manager does not deactivate previous environment #49188
Copy link
Copy link
Closed
Labels
Description
Steps to reproduce
This can be reproduced with the following config_scopes.py script:
# config_scopes.py
import spack.config
import spack.environment
print(f"BEFORE: {', '.join(spack.config.CONFIG.scopes)}\n")
with spack.environment.read("test"):
print(f"test-env: {', '.join(spack.config.CONFIG.scopes)}\n")
print(f"AFTER: {', '.join(spack.config.CONFIG.scopes)}\n")Running the following commands:
$ spack env create test
$ spack env activate --temp
$ spack python config_scopes.py
Error message
No error message, but the output:
$ spack python try.py
BEFORE: _builtin, defaults, defaults/linux, system, system/linux, site, site/linux, user, user/linux, env:/tmp/spack-usl4w43m, command_line
test-env: _builtin, defaults, defaults/linux, system, system/linux, site, site/linux, user, user/linux, env:/tmp/spack-usl4w43m, env:test, command_line
AFTER: _builtin, defaults, defaults/linux, system, system/linux, site, site/linux, user, user/linux, env:/tmp/spack-usl4w43m, command_lineshows that within the context manager two environment scopes are active.
Information on your system
- Spack: 1.0.0.dev0 (9e508b0)
- Python: 3.13.0
- Platform: linux-ubuntu20.04-icelake
General information
- I have run
spack debug reportand reported the version of Spack/Python/Platform - I have searched the issues of this repo and believe this is not a duplicate
- I have run the failing commands in debug mode and reported the output
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Done