MCPcopy Create free account
hub / github.com/conda/constructor / test_example_miniforge

Function test_example_miniforge

tests/test_examples.py:815–869  ·  view source on GitHub ↗
(tmp_path, request, example, installer_name, installer_version)

Source from the content-addressed store, hash-verified

813 ],
814)
815def test_example_miniforge(tmp_path, request, example, installer_name, installer_version):
816 input_path = _example_path(example)
817 for installer, install_dir in create_installer(input_path, tmp_path):
818 if installer.suffix == ".sh":
819 # try both batch and interactive installations
820 install_dirs = (install_dir / "batch", install_dir / "interactive")
821 installer_inputs = (None, f"\nyes\n{install_dir / 'interactive'}\nno\nno\n")
822 else:
823 install_dirs = (install_dir,)
824 installer_inputs = (None,)
825 for installer_input, install_dir in zip(installer_inputs, install_dirs):
826 _run_installer(
827 input_path,
828 installer,
829 install_dir,
830 installer_input=installer_input,
831 request=request,
832 # PKG installers use their own install path, so we can't check sentinels
833 # via `install_dir`
834 check_sentinels=installer.suffix != ".pkg",
835 uninstall=False,
836 )
837 # Check that key metadata files are in place
838 assert install_dir.glob("conda-meta/*.json")
839 assert install_dir.glob("pkgs/cache/*.json") # enables offline installs
840 # Check that the installer info file is in place
841 info_file_name = ".installer.info"
842 if installer.suffix == ".msi":
843 info_file = install_dir / "base" / info_file_name
844 else:
845 info_file = install_dir / info_file_name
846 assert info_file.is_file()
847 installer_info = json.loads(info_file.read_text())
848 assert installer_info["name"] == installer_name
849 assert installer_info["version"] == installer_version
850 assert installer_info["platform"] == cc_platform
851 assert installer_info["type"] == installer.suffix[1:]
852 if installer.suffix == ".pkg" and ON_CI:
853 _sentinel_file_checks(input_path, Path(os.environ["HOME"]) / installer_name)
854 if installer.suffix == ".exe":
855 for key in ("ProgramData", "AppData"):
856 start_menu_dir = Path(
857 os.environ[key],
858 "Microsoft/Windows/Start Menu/Programs/Miniforge3",
859 )
860 if start_menu_dir.is_dir():
861 assert list(start_menu_dir.glob("Miniforge*.lnk"))
862 break
863 else:
864 raise AssertionError("Could not find Start Menu folder for miniforge")
865 _run_uninstaller_exe(install_dir)
866 assert not list(start_menu_dir.glob("Miniforge*.lnk"))
867 elif installer.suffix == ".msi":
868 # TODO: Start menus
869 _run_uninstaller_msi(installer, install_dir)
870
871
872def test_example_noconda(tmp_path, request):

Callers

nothing calls this directly

Calls 7

_example_pathFunction · 0.85
create_installerFunction · 0.85
_run_installerFunction · 0.85
_sentinel_file_checksFunction · 0.85
_run_uninstaller_exeFunction · 0.85
_run_uninstaller_msiFunction · 0.85
read_textMethod · 0.45

Tested by

no test coverage detected