@@ -1416,3 +1416,73 @@ fn python_install_cached() {
14161416 Caused by: An offline Python installation was requested, but cpython-3.12.10[DATE]-[PLATFORM].tar.gz) is missing in python-cache
14171417 " ) ;
14181418}
1419+
1420+ #[ cfg( target_os = "macos" ) ]
1421+ #[ test]
1422+ fn python_install_emulated_macos ( ) {
1423+ let context: TestContext = TestContext :: new_with_versions ( & [ ] )
1424+ . with_filtered_exe_suffix ( )
1425+ . with_managed_python_dirs ( ) ;
1426+
1427+ // Before installation, `uv python list` should not show the x86_64 download
1428+ uv_snapshot ! ( context. filters( ) , context. python_list( ) . arg( "3.13" ) , @r"
1429+ success: true
1430+ exit_code: 0
1431+ ----- stdout -----
1432+ cpython-3.13.3-macos-aarch64-none <download available>
1433+
1434+ ----- stderr -----
1435+ " ) ;
1436+
1437+ // Install an x86_64 version (assuming an aarch64 host)
1438+ uv_snapshot ! ( context. filters( ) , context. python_install( ) . arg( "cpython-3.13-macos-x86_64" ) , @r"
1439+ success: true
1440+ exit_code: 0
1441+ ----- stdout -----
1442+
1443+ ----- stderr -----
1444+ Installed Python 3.13.3 in [TIME]
1445+ + cpython-3.13.3-macos-x86_64-none
1446+ " ) ;
1447+
1448+ // It should be discoverable with `uv python find`
1449+ uv_snapshot ! ( context. filters( ) , context. python_find( ) . arg( "3.13" ) , @r"
1450+ success: true
1451+ exit_code: 0
1452+ ----- stdout -----
1453+ [TEMP_DIR]/managed/cpython-3.13.3-macos-x86_64-none/bin/python3.13
1454+
1455+ ----- stderr -----
1456+ " ) ;
1457+
1458+ // And included in `uv python list`
1459+ uv_snapshot ! ( context. filters( ) , context. python_list( ) . arg( "3.13" ) , @r"
1460+ success: true
1461+ exit_code: 0
1462+ ----- stdout -----
1463+ cpython-3.13.3-macos-aarch64-none <download available>
1464+ cpython-3.13.3-macos-x86_64-none managed/cpython-3.13.3-macos-x86_64-none/bin/python3.13
1465+
1466+ ----- stderr -----
1467+ " ) ;
1468+
1469+ uv_snapshot ! ( context. filters( ) , context. python_install( ) . arg( "cpython-3.13-macos-aarch64" ) , @r"
1470+ success: true
1471+ exit_code: 0
1472+ ----- stdout -----
1473+
1474+ ----- stderr -----
1475+ Installed Python 3.13.3 in [TIME]
1476+ + cpython-3.13.3-macos-aarch64-none
1477+ " ) ;
1478+
1479+ // Once we've installed the native version, it should be preferred over x86_64
1480+ uv_snapshot ! ( context. filters( ) , context. python_find( ) . arg( "3.13" ) , @r"
1481+ success: true
1482+ exit_code: 0
1483+ ----- stdout -----
1484+ [TEMP_DIR]/managed/cpython-3.13.3-macos-aarch64-none/bin/python3.13
1485+
1486+ ----- stderr -----
1487+ " ) ;
1488+ }
0 commit comments