Skip to content

Commit

Permalink
Do not use conda fixtures for menuinst tests
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoesters committed Nov 19, 2024
1 parent cdd46cc commit 91f6fb1
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions tests/test_uninstall.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@ def test_uninstallation_keep_config_dir(
def test_uninstallation_menuinst(
mock_system_paths: dict[str, Path],
monkeypatch: MonkeyPatch,
tmp_env: TmpEnvFixture,
):
def _shortcuts_found(shortcut_env: Path) -> list:
variables = {
Expand Down Expand Up @@ -279,16 +278,18 @@ def _shortcuts_found(shortcut_env: Path) -> list:
"AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs",
):
(mock_system_paths["home"] / subdir).mkdir(parents=True, exist_ok=True)
with tmp_env() as base_env:
monkeypatch.setenv("CONDA_ROOT_PREFIX", str(base_env))
monkeypatch.setenv("MENUINST_BASE_PREFIX", str(base_env))
shortcuts = [package[0] for package in menuinst_pkg_specs]
(base_env / ".nonadmin").touch()
shortcut_env_path = base_env / "envs" / "shortcutenv"
with tmp_env(*shortcuts, prefix=shortcut_env_path) as shortcut_env:
assert _shortcuts_found(shortcut_env) == shortcuts
run_uninstaller(base_env)
assert _shortcuts_found(shortcut_env) == []
base_env = mock_system_paths["home"] / "baseenv"
monkeypatch.setenv("CONDA_ROOT_PREFIX", str(base_env))
# Conda test fixtures cannot be used here because menuinst
# will not use monkeypatched paths.
run_conda("create", "-y", "-p", str(base_env))
(base_env / ".nonadmin").touch()
shortcuts = [package[0] for package in menuinst_pkg_specs]
shortcut_env = base_env / "envs" / "shortcutenv"
run_conda("create", "-y", "-p", str(shortcut_env), *shortcuts)
assert _shortcuts_found(shortcut_env) == shortcuts
run_uninstaller(base_env)
assert _shortcuts_found(shortcut_env) == []


@pytest.mark.parametrize(
Expand Down

0 comments on commit 91f6fb1

Please sign in to comment.