Skip to content

Commit

Permalink
Use different condarc locations for sudo and non-sudo runs
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoesters committed Nov 14, 2024
1 parent d882895 commit 684640c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tests/test_uninstall.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ def test_uninstallation_remove_condarcs(
"channels": [CONDA_CHANNEL],
}
needs_sudo = False
user_condarc = mock_system_paths["confighome"] / "conda" / ".condarc"
if ON_WIN:
system_condarc = Path("C:/ProgramData/conda/.condarc")
else:
Expand All @@ -347,7 +348,8 @@ def test_uninstallation_remove_condarcs(
text=True,
)
mock_system_paths["confighome"] = Path(proc.stdout.strip())
user_condarc = mock_system_paths["confighome"] / ".condarc"
user_condarc = mock_system_paths["confighome"] / ".condarc"

for condarc_file in (system_condarc, user_condarc):
if needs_sudo:
from textwrap import dedent
Expand Down Expand Up @@ -391,8 +393,8 @@ def test_uninstallation_remove_condarcs(
assert system_condarc.exists() != remove_system
finally:
system_conda_dirs = [system_condarc.parent]
if not ON_WIN:
system_conda_dirs = [Path("/etc/conda/"), mock_system_paths["confighome"]]
if needs_sudo:
system_conda_dirs.append(mock_system_paths["confighome"] / ".condarc")
for system_dir in system_conda_dirs:
if not system_dir.exists():
continue
Expand Down

0 comments on commit 684640c

Please sign in to comment.