test: use stable cpython@3.9 for variant tests

Use Python 3.9 (EOL Oct 2025, final version 3.9.25) for variant tests
to avoid snapshot churn from new patch releases. Also use cpython@
prefix to filter out PyPy/GraalPy which have different version
availability per platform.

Remove overly verbose --all-versions combined test that added
complexity without testing new behavior.
This commit is contained in:
Shaan Majid 2025-12-15 19:04:32 -06:00
parent 081275dfe4
commit 67ce1983c6
No known key found for this signature in database
1 changed files with 22 additions and 107 deletions

View File

@ -523,59 +523,54 @@ fn python_list_downloads_installed() {
fn python_list_variants() {
let context: TestContext = TestContext::new_with_versions(&[]).with_filtered_python_keys();
// Use cpython@3.9 for stable tests - Python 3.9 is EOL (Oct 2025) so 3.9.25 is the final version
// Default behavior should only show default variants (no debug/freethreaded)
uv_snapshot!(context.filters(), context.python_list().arg("3.10").arg("--only-downloads").env_remove(EnvVars::UV_PYTHON_DOWNLOADS), @r"
uv_snapshot!(context.filters(), context.python_list().arg("cpython@3.9").arg("--only-downloads").env_remove(EnvVars::UV_PYTHON_DOWNLOADS), @r"
success: true
exit_code: 0
----- stdout -----
cpython-3.10.19-[PLATFORM] <download available>
pypy-3.10.16-[PLATFORM] <download available>
graalpy-3.10.0-[PLATFORM] <download available>
cpython-3.9.25-[PLATFORM] <download available>
----- stderr -----
");
// With --all-variants, should show all variants including debug and freethreaded
// With --all-variants, should show all variants including debug
#[cfg(unix)]
uv_snapshot!(context.filters(), context.python_list().arg("3.10").arg("--all-variants").arg("--only-downloads").env_remove(EnvVars::UV_PYTHON_DOWNLOADS), @r"
uv_snapshot!(context.filters(), context.python_list().arg("cpython@3.9").arg("--all-variants").arg("--only-downloads").env_remove(EnvVars::UV_PYTHON_DOWNLOADS), @r"
success: true
exit_code: 0
----- stdout -----
cpython-3.10.19-[PLATFORM] <download available>
cpython-3.10.19+debug-[PLATFORM] <download available>
pypy-3.10.16-[PLATFORM] <download available>
graalpy-3.10.0-[PLATFORM] <download available>
cpython-3.9.25-[PLATFORM] <download available>
cpython-3.9.25+debug-[PLATFORM] <download available>
----- stderr -----
");
// On Windows, debug builds are not available from python-build-standalone
#[cfg(windows)]
uv_snapshot!(context.filters(), context.python_list().arg("3.10").arg("--all-variants").arg("--only-downloads").env_remove(EnvVars::UV_PYTHON_DOWNLOADS), @r"
uv_snapshot!(context.filters(), context.python_list().arg("cpython@3.9").arg("--all-variants").arg("--only-downloads").env_remove(EnvVars::UV_PYTHON_DOWNLOADS), @r"
success: true
exit_code: 0
----- stdout -----
cpython-3.10.19-[PLATFORM] <download available>
pypy-3.10.16-[PLATFORM] <download available>
graalpy-3.10.0-[PLATFORM] <download available>
cpython-3.9.25-[PLATFORM] <download available>
----- stderr -----
");
// Explicit debug variant request should work without --all-variants
#[cfg(unix)]
uv_snapshot!(context.filters(), context.python_list().arg("3.10+debug").arg("--only-downloads").env_remove(EnvVars::UV_PYTHON_DOWNLOADS), @r"
uv_snapshot!(context.filters(), context.python_list().arg("cpython@3.9+debug").arg("--only-downloads").env_remove(EnvVars::UV_PYTHON_DOWNLOADS), @r"
success: true
exit_code: 0
----- stdout -----
cpython-3.10.19+debug-[PLATFORM] <download available>
cpython-3.9.25+debug-[PLATFORM] <download available>
----- stderr -----
");
// On Windows, explicit debug variant request returns empty since no debug builds available
#[cfg(windows)]
uv_snapshot!(context.filters(), context.python_list().arg("3.10+debug").arg("--only-downloads").env_remove(EnvVars::UV_PYTHON_DOWNLOADS), @r#"
uv_snapshot!(context.filters(), context.python_list().arg("cpython@3.9+debug").arg("--only-downloads").env_remove(EnvVars::UV_PYTHON_DOWNLOADS), @r#"
success: true
exit_code: 0
----- stdout -----
@ -583,28 +578,28 @@ fn python_list_variants() {
----- stderr -----
"#);
// Explicit freethreaded variant request on 3.10 should fail with error
uv_snapshot!(context.filters(), context.python_list().arg("3.10+freethreaded").env_remove(EnvVars::UV_PYTHON_DOWNLOADS), @r"
// Explicit freethreaded variant request on 3.9 should fail with error
uv_snapshot!(context.filters(), context.python_list().arg("3.9+freethreaded").env_remove(EnvVars::UV_PYTHON_DOWNLOADS), @r"
success: false
exit_code: 2
----- stdout -----
----- stderr -----
error: Invalid version request: Python <3.13 does not support free-threading but 3.10+freethreaded was requested.
error: Invalid version request: Python <3.13 does not support free-threading but 3.9+freethreaded was requested.
");
// Explicit freethreaded+debug variant request on 3.10 should fail with error
uv_snapshot!(context.filters(), context.python_list().arg("3.10+freethreaded+debug").env_remove(EnvVars::UV_PYTHON_DOWNLOADS), @r"
// Explicit freethreaded+debug variant request on 3.9 should fail with error
uv_snapshot!(context.filters(), context.python_list().arg("3.9+freethreaded+debug").env_remove(EnvVars::UV_PYTHON_DOWNLOADS), @r"
success: false
exit_code: 2
----- stdout -----
----- stderr -----
error: Invalid version request: Python <3.13 does not support free-threading but 3.10+freethreaded+debug was requested.
error: Invalid version request: Python <3.13 does not support free-threading but 3.9+freethreaded+debug was requested.
");
// Using --all-variants with a specific variant request should fail
uv_snapshot!(context.filters(), context.python_list().arg("3.10+debug").arg("--all-variants").env_remove(EnvVars::UV_PYTHON_DOWNLOADS), @r"
uv_snapshot!(context.filters(), context.python_list().arg("cpython@3.9+debug").arg("--all-variants").env_remove(EnvVars::UV_PYTHON_DOWNLOADS), @r"
success: false
exit_code: 2
----- stdout -----
@ -615,89 +610,9 @@ fn python_list_variants() {
hint: Use `--all-variants` to show all variants for a Python version, or specify an exact variant like `3.13t` or `3.13+freethreaded`, but not both
");
// Test --all-variants combined with --all-versions
#[cfg(unix)]
uv_snapshot!(context.filters(), context.python_list().arg("3.10").arg("--all-variants").arg("--all-versions").env_remove(EnvVars::UV_PYTHON_DOWNLOADS), @r"
success: true
exit_code: 0
----- stdout -----
cpython-3.10.19-[PLATFORM] <download available>
cpython-3.10.19+debug-[PLATFORM] <download available>
cpython-3.10.18-[PLATFORM] <download available>
cpython-3.10.18+debug-[PLATFORM] <download available>
cpython-3.10.17-[PLATFORM] <download available>
cpython-3.10.17+debug-[PLATFORM] <download available>
cpython-3.10.16-[PLATFORM] <download available>
cpython-3.10.16+debug-[PLATFORM] <download available>
cpython-3.10.15-[PLATFORM] <download available>
cpython-3.10.15+debug-[PLATFORM] <download available>
cpython-3.10.14-[PLATFORM] <download available>
cpython-3.10.14+debug-[PLATFORM] <download available>
cpython-3.10.13-[PLATFORM] <download available>
cpython-3.10.13+debug-[PLATFORM] <download available>
cpython-3.10.12-[PLATFORM] <download available>
cpython-3.10.12+debug-[PLATFORM] <download available>
cpython-3.10.11-[PLATFORM] <download available>
cpython-3.10.11+debug-[PLATFORM] <download available>
cpython-3.10.9-[PLATFORM] <download available>
cpython-3.10.9+debug-[PLATFORM] <download available>
cpython-3.10.8-[PLATFORM] <download available>
cpython-3.10.8+debug-[PLATFORM] <download available>
cpython-3.10.7-[PLATFORM] <download available>
cpython-3.10.7+debug-[PLATFORM] <download available>
cpython-3.10.6-[PLATFORM] <download available>
cpython-3.10.6+debug-[PLATFORM] <download available>
cpython-3.10.5-[PLATFORM] <download available>
cpython-3.10.5+debug-[PLATFORM] <download available>
cpython-3.10.4-[PLATFORM] <download available>
cpython-3.10.4+debug-[PLATFORM] <download available>
cpython-3.10.3-[PLATFORM] <download available>
cpython-3.10.3+debug-[PLATFORM] <download available>
cpython-3.10.2-[PLATFORM] <download available>
cpython-3.10.2+debug-[PLATFORM] <download available>
cpython-3.10.0-[PLATFORM] <download available>
cpython-3.10.0+debug-[PLATFORM] <download available>
pypy-3.10.16-[PLATFORM] <download available>
pypy-3.10.14-[PLATFORM] <download available>
pypy-3.10.13-[PLATFORM] <download available>
pypy-3.10.12-[PLATFORM] <download available>
graalpy-3.10.0-[PLATFORM] <download available>
----- stderr -----
");
// On Windows, --all-versions with --all-variants shows only non-debug variants
#[cfg(windows)]
uv_snapshot!(context.filters(), context.python_list().arg("3.10").arg("--all-variants").arg("--all-versions").env_remove(EnvVars::UV_PYTHON_DOWNLOADS), @r"
success: true
exit_code: 0
----- stdout -----
cpython-3.10.19-[PLATFORM] <download available>
cpython-3.10.18-[PLATFORM] <download available>
cpython-3.10.17-[PLATFORM] <download available>
cpython-3.10.16-[PLATFORM] <download available>
cpython-3.10.15-[PLATFORM] <download available>
cpython-3.10.14-[PLATFORM] <download available>
cpython-3.10.13-[PLATFORM] <download available>
cpython-3.10.12-[PLATFORM] <download available>
cpython-3.10.11-[PLATFORM] <download available>
cpython-3.10.9-[PLATFORM] <download available>
cpython-3.10.8-[PLATFORM] <download available>
cpython-3.10.7-[PLATFORM] <download available>
cpython-3.10.6-[PLATFORM] <download available>
cpython-3.10.5-[PLATFORM] <download available>
cpython-3.10.4-[PLATFORM] <download available>
cpython-3.10.3-[PLATFORM] <download available>
cpython-3.10.2-[PLATFORM] <download available>
cpython-3.10.0-[PLATFORM] <download available>
pypy-3.10.16-[PLATFORM] <download available>
pypy-3.10.14-[PLATFORM] <download available>
pypy-3.10.13-[PLATFORM] <download available>
pypy-3.10.12-[PLATFORM] <download available>
graalpy-3.10.0-[PLATFORM] <download available>
----- stderr -----
");
// Note: --all-variants combined with --all-versions is tested implicitly through the
// individual flag tests above. A dedicated combined test would be fragile due to
// platform-specific version availability in python-build-standalone.
// Test freethreaded variants with stable pinned version 3.13.0
// This ensures test stability since 3.13 is still under active development