(tmp_path, request)
| 1014 | reason="menuinst v2 requires conda-standalone>=23.11.0; micromamba is not supported yet", |
| 1015 | ) |
| 1016 | def test_example_shortcuts(tmp_path, request): |
| 1017 | input_path = _example_path("shortcuts") |
| 1018 | for installer, install_dir in create_installer(input_path, tmp_path): |
| 1019 | # console_shortcut package uses hardcoded "Anaconda3" in its menu definition |
| 1020 | distribution_name = "Anaconda3" |
| 1021 | if sys.platform == "win32": |
| 1022 | # Verify shortcuts don't exist before installation (not leftover from previous run (since EXE/MSI run in a loop)) |
| 1023 | for key in ("ProgramData", "AppData"): |
| 1024 | start_menu = Path(os.environ[key]) / "Microsoft/Windows/Start Menu/Programs" |
| 1025 | package_1 = start_menu / "Package 1" |
| 1026 | if package_1.is_dir(): |
| 1027 | assert not (package_1 / "A.lnk").is_file(), "A.lnk exists before installation" |
| 1028 | assert not (package_1 / "B.lnk").is_file(), "B.lnk exists before installation" |
| 1029 | |
| 1030 | _run_installer(input_path, installer, install_dir, request=request, uninstall=False) |
| 1031 | # check that the shortcuts are created |
| 1032 | if sys.platform == "win32": |
| 1033 | for key in ("ProgramData", "AppData"): |
| 1034 | start_menu = Path(os.environ[key]) / "Microsoft/Windows/Start Menu/Programs" |
| 1035 | package_1 = start_menu / "Package 1" |
| 1036 | console_shortcut_dir = start_menu / f"{distribution_name} (64-bit)" |
| 1037 | if package_1.is_dir() and console_shortcut_dir.is_dir(): |
| 1038 | assert (package_1 / "A.lnk").is_file() |
| 1039 | assert (package_1 / "B.lnk").is_file() |
| 1040 | # The shortcut created from the 'base' env |
| 1041 | # should not exist because we filtered it out in the YAML |
| 1042 | # We do expect one shortcut from 'another_env' |
| 1043 | assert not (console_shortcut_dir / "Anaconda Prompt.lnk").is_file() |
| 1044 | assert (console_shortcut_dir / "Anaconda Prompt (another_env).lnk").is_file() |
| 1045 | break |
| 1046 | else: |
| 1047 | raise AssertionError(f"No shortcuts found! Expected '{distribution_name} (64-bit)'") |
| 1048 | if installer.suffix == ".msi": |
| 1049 | _run_uninstaller_msi(installer, install_dir) |
| 1050 | else: |
| 1051 | _run_uninstaller_exe(install_dir) |
| 1052 | assert not (package_1 / "A.lnk").is_file() |
| 1053 | assert not (package_1 / "B.lnk").is_file() |
| 1054 | elif sys.platform == "darwin": |
| 1055 | applications = Path("~/Applications").expanduser() |
| 1056 | print("Shortcuts found:", sorted(applications.glob("**/*.app"))) |
| 1057 | assert (applications / "A.app").exists() |
| 1058 | assert (applications / "B.app").exists() |
| 1059 | elif sys.platform == "linux": |
| 1060 | applications = Path("~/.local/share/applications").expanduser() |
| 1061 | print("Shortcuts found:", sorted(applications.glob("**/*.desktop"))) |
| 1062 | assert (applications / "package-1_a.desktop").exists() |
| 1063 | assert (applications / "package-1_b.desktop").exists() |
| 1064 | |
| 1065 | |
| 1066 | def _verify_windows_signature(installer: Path): |
nothing calls this directly
no test coverage detected