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

Function test_pkg_distribution_domains

tests/test_examples.py:1222–1243  ·  view source on GitHub ↗
(tmp_path, domains)

Source from the content-addressed store, hash-verified

1220@pytest.mark.skipif(sys.platform != "darwin", reason="macOS only")
1221@pytest.mark.parametrize("domains", ({}, {"enable_anywhere": "false", "enable_localSystem": True}))
1222def test_pkg_distribution_domains(tmp_path, domains):
1223 recipe_path = _example_path("osxpkg")
1224 input_path = tmp_path / "input"
1225 output_path = tmp_path / "output"
1226 shutil.copytree(str(recipe_path), str(input_path))
1227 if domains:
1228 with open(input_path / "construct.yaml", "a") as cyml:
1229 cyml.write("pkg_domains:\n")
1230 for key, val in domains.items():
1231 cyml.write(f" {key}: {val}\n")
1232
1233 installer, install_dir = next(create_installer(input_path, output_path))
1234 cmd = ["pkgutil", "--expand", installer, output_path / "expanded"]
1235 _execute(cmd)
1236 domains_file = output_path / "expanded" / "Distribution"
1237 assert domains_file.exists()
1238
1239 tree = ET.parse(domains_file)
1240 found = {key: val for key, val in tree.find("domains").items()}
1241 defaults = {"enable_anywhere": "true", "enable_currentUserHome": "true"}
1242 expected = {key: str(val).lower() for key, val in domains.items()} if domains else defaults
1243 assert expected == found
1244
1245
1246@pytest.mark.skipif(sys.platform != "darwin", reason="macOS only")

Callers

nothing calls this directly

Calls 3

_example_pathFunction · 0.85
create_installerFunction · 0.85
_executeFunction · 0.85

Tested by

no test coverage detected