Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #2271, 2nd attempt #2305

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

jonashaag
Copy link
Collaborator

So far adds a failing test.

cc @wolfv @Hind-M

@@ -72,6 +67,10 @@ def keep_in_path(
path_list = [p for p in path_list if keep_in_path(p)]
os.environ["PATH"] = os.pathsep.join(path_list)

saved_environ = os.environ.copy()
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous impl did not restore PATH. I assumed that to be a mistake and fixed the code accordingly.

saved_environ = {}
for k, v in os.environ.items():
if k.startswith(("CONDA", "_CONDA", "MAMBA", "_MAMBA")):
saved_environ[k] = v
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this should not be removed since it's used below in:

def keep_in_path(
    p: str, prefix: str | None = saved_environ.get("CONDA_PREFIX")

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, forgot to commit a change that changes this to os.environ.get("CONDA_PREFIX")

@jonashaag
Copy link
Collaborator Author

Actually the test is supposed to fail 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants