@@ -15,6 +15,92 @@ fn python_install() {
15
15
exit_code: 0
16
16
----- stdout -----
17
17
18
+ ----- stderr -----
19
+ Searching for Python installations
20
+ Installed Python 3.13.0 in [TIME]
21
+ + cpython-3.13.0-[PLATFORM]
22
+ "### ) ;
23
+
24
+ let bin_python = context
25
+ . temp_dir
26
+ . child ( "bin" )
27
+ . child ( format ! ( "python3.13{}" , std:: env:: consts:: EXE_SUFFIX ) ) ;
28
+
29
+ // The executable should not be installed in the bin directory (requires preview)
30
+ bin_python. assert ( predicate:: path:: missing ( ) ) ;
31
+
32
+ // Should be a no-op when already installed
33
+ uv_snapshot ! ( context. filters( ) , context. python_install( ) , @r###"
34
+ success: true
35
+ exit_code: 0
36
+ ----- stdout -----
37
+
38
+ ----- stderr -----
39
+ Searching for Python installations
40
+ Found: cpython-3.13.0-[PLATFORM]
41
+ Python is already available. Use `uv python install <request>` to install a specific version.
42
+ "### ) ;
43
+
44
+ // Similarly, when a requested version is already installed
45
+ uv_snapshot ! ( context. filters( ) , context. python_install( ) . arg( "3.13" ) , @r###"
46
+ success: true
47
+ exit_code: 0
48
+ ----- stdout -----
49
+
50
+ ----- stderr -----
51
+ Searching for Python versions matching: Python 3.13
52
+ Found existing installation for Python 3.13: cpython-3.13.0-[PLATFORM]
53
+ "### ) ;
54
+
55
+ // You can opt-in to a reinstall
56
+ uv_snapshot ! ( context. filters( ) , context. python_install( ) . arg( "--reinstall" ) , @r###"
57
+ success: true
58
+ exit_code: 0
59
+ ----- stdout -----
60
+
61
+ ----- stderr -----
62
+ Searching for Python installations
63
+ Found: cpython-3.13.0-[PLATFORM]
64
+ Installed Python 3.13.0 in [TIME]
65
+ ~ cpython-3.13.0-[PLATFORM]
66
+ "### ) ;
67
+
68
+ // Uninstallation requires an argument
69
+ uv_snapshot ! ( context. filters( ) , context. python_uninstall( ) , @r###"
70
+ success: false
71
+ exit_code: 2
72
+ ----- stdout -----
73
+
74
+ ----- stderr -----
75
+ error: the following required arguments were not provided:
76
+ <TARGETS>...
77
+
78
+ Usage: uv python uninstall <TARGETS>...
79
+
80
+ For more information, try '--help'.
81
+ "### ) ;
82
+
83
+ uv_snapshot ! ( context. filters( ) , context. python_uninstall( ) . arg( "3.13" ) , @r###"
84
+ success: false
85
+ exit_code: 2
86
+ ----- stdout -----
87
+
88
+ ----- stderr -----
89
+ Searching for Python versions matching: Python 3.13
90
+ error: No such file or directory (os error 2)
91
+ "### ) ;
92
+ }
93
+
94
+ #[ test]
95
+ fn python_install_preview ( ) {
96
+ let context: TestContext = TestContext :: new_with_versions ( & [ ] ) . with_filtered_python_keys ( ) ;
97
+
98
+ // Install the latest version
99
+ uv_snapshot ! ( context. filters( ) , context. python_install( ) . arg( "--preview" ) , @r###"
100
+ success: true
101
+ exit_code: 0
102
+ ----- stdout -----
103
+
18
104
----- stderr -----
19
105
Searching for Python installations
20
106
Installed Python 3.13.0 in [TIME]
@@ -46,7 +132,7 @@ fn python_install() {
46
132
"### ) ;
47
133
48
134
// Should be a no-op when already installed
49
- uv_snapshot ! ( context. filters( ) , context. python_install( ) , @r###"
135
+ uv_snapshot ! ( context. filters( ) , context. python_install( ) . arg ( "--preview" ) , @r###"
50
136
success: true
51
137
exit_code: 0
52
138
----- stdout -----
@@ -57,19 +143,8 @@ fn python_install() {
57
143
Python is already available. Use `uv python install <request>` to install a specific version.
58
144
"### ) ;
59
145
60
- // Similarly, when a requested version is already installed
61
- uv_snapshot ! ( context. filters( ) , context. python_install( ) . arg( "3.13" ) , @r###"
62
- success: true
63
- exit_code: 0
64
- ----- stdout -----
65
-
66
- ----- stderr -----
67
- Searching for Python versions matching: Python 3.13
68
- Found existing installation for Python 3.13: cpython-3.13.0-[PLATFORM]
69
- "### ) ;
70
-
71
146
// You can opt-in to a reinstall
72
- uv_snapshot ! ( context. filters( ) , context. python_install( ) . arg( "--reinstall" ) , @r###"
147
+ uv_snapshot ! ( context. filters( ) , context. python_install( ) . arg( "--preview" ) . arg ( "-- reinstall") , @r###"
73
148
success: true
74
149
exit_code: 0
75
150
----- stdout -----
@@ -120,7 +195,7 @@ fn python_install_freethreaded() {
120
195
let context: TestContext = TestContext :: new_with_versions ( & [ ] ) . with_filtered_python_keys ( ) ;
121
196
122
197
// Install the latest version
123
- uv_snapshot ! ( context. filters( ) , context. python_install( ) . arg( "3.13t" ) , @r###"
198
+ uv_snapshot ! ( context. filters( ) , context. python_install( ) . arg( "--preview" ) . arg ( " 3.13t") , @r###"
124
199
success: true
125
200
exit_code: 0
126
201
----- stdout -----
@@ -165,7 +240,6 @@ fn python_install_freethreaded() {
165
240
Searching for Python versions matching: Python 3.13
166
241
Installed Python 3.13.0 in [TIME]
167
242
+ cpython-3.13.0-[PLATFORM]
168
- warning: `[TEMP_DIR]/bin` is not on your PATH. To use the installed Python executable, run `export PATH="[TEMP_DIR]/bin:$PATH"`.
169
243
"### ) ;
170
244
171
245
// Should not work with older Python versions
0 commit comments