(tmp_path, domains)
| 1220 | @pytest.mark.skipif(sys.platform != "darwin", reason="macOS only") |
| 1221 | @pytest.mark.parametrize("domains", ({}, {"enable_anywhere": "false", "enable_localSystem": True})) |
| 1222 | def 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") |
nothing calls this directly
no test coverage detected