Verify that virtual packages listed via 'virtual_specs' are satisfied.
(tmp_path, request)
| 1288 | |
| 1289 | |
| 1290 | def test_virtual_specs_failed(tmp_path, request): |
| 1291 | """Verify that virtual packages listed via 'virtual_specs' are satisfied.""" |
| 1292 | input_path = _example_path("virtual_specs_failed") |
| 1293 | for installer, install_dir in create_installer(input_path, tmp_path): |
| 1294 | process = _run_installer( |
| 1295 | input_path, |
| 1296 | installer, |
| 1297 | install_dir, |
| 1298 | request=request, |
| 1299 | check_subprocess=False, |
| 1300 | uninstall=False, |
| 1301 | ) |
| 1302 | # This example is configured to fail due to unsatisfiable virtual specs |
| 1303 | if installer.suffix == ".exe": |
| 1304 | with pytest.raises(AssertionError, match="Failed to check virtual specs"): |
| 1305 | _check_installer_log(install_dir) |
| 1306 | continue |
| 1307 | elif installer.suffix == ".msi": |
| 1308 | # MSI writes errors to install.log in the install directory |
| 1309 | msi_post_install_log = install_dir / "install.log" |
| 1310 | if msi_post_install_log.exists(): |
| 1311 | log_content = msi_post_install_log.read_text(encoding="utf-8", errors="replace") |
| 1312 | assert "Failed to check virtual specs" in log_content |
| 1313 | else: |
| 1314 | # If log doesn't exist, installation failed before post-install script ran |
| 1315 | assert process.returncode != 0 |
| 1316 | continue |
| 1317 | elif installer.suffix == ".pkg": |
| 1318 | if not ON_CI: |
| 1319 | continue |
| 1320 | # The GUI does provide a better message with the min version and so on |
| 1321 | # but on the CLI we fail with this one instead |
| 1322 | msg = "Cannot install on volume" |
| 1323 | else: |
| 1324 | # The shell installer has its own Bash code for __glibc and __osx |
| 1325 | # Other virtual specs like __cuda are checked by conda-standalone/micromamba |
| 1326 | # and will fail with solver errors like PackagesNotFound etc |
| 1327 | msg = "Installer requires" |
| 1328 | assert process.returncode != 0 |
| 1329 | assert msg in process.stdout + process.stderr |
| 1330 | |
| 1331 | |
| 1332 | def test_virtual_specs_ok(tmp_path, request): |
nothing calls this directly
no test coverage detected