-
Notifications
You must be signed in to change notification settings - Fork 988
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add basic testing of managed Python installs (#8462)
With a change like #8458, we really need tests for these. I'm just going to take the possible performance hit of these slow tests and deal with optimizing them separately.
- Loading branch information
Showing
4 changed files
with
113 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
use crate::common::{uv_snapshot, TestContext}; | ||
|
||
#[test] | ||
fn python_install() { | ||
let context: TestContext = TestContext::new_with_versions(&[]).with_filtered_python_keys(); | ||
|
||
// Install the latest version | ||
uv_snapshot!(context.filters(), context.python_install(), @r###" | ||
success: true | ||
exit_code: 0 | ||
----- stdout ----- | ||
----- stderr ----- | ||
Searching for Python installations | ||
Installed Python 3.13.0 in [TIME] | ||
+ cpython-3.13.0-[PLATFORM] | ||
"###); | ||
|
||
// Should be a no-op when already installed | ||
uv_snapshot!(context.filters(), context.python_install(), @r###" | ||
success: true | ||
exit_code: 0 | ||
----- stdout ----- | ||
----- stderr ----- | ||
Searching for Python installations | ||
Installed Python 3.13.0 in [TIME] | ||
+ cpython-3.13.0-[PLATFORM] | ||
"###); | ||
|
||
// Similarly, when a requested version is already installed | ||
uv_snapshot!(context.filters(), context.python_install().arg("3.13"), @r###" | ||
success: true | ||
exit_code: 0 | ||
----- stdout ----- | ||
----- stderr ----- | ||
Searching for Python versions matching: Python 3.13 | ||
Installed Python 3.13.0 in [TIME] | ||
+ cpython-3.13.0-[PLATFORM] | ||
"###); | ||
} | ||
|
||
#[test] | ||
fn python_install_freethreaded() { | ||
let context: TestContext = TestContext::new_with_versions(&[]).with_filtered_python_keys(); | ||
|
||
// Install the latest version | ||
uv_snapshot!(context.filters(), context.python_install().arg("3.13t"), @r###" | ||
success: true | ||
exit_code: 0 | ||
----- stdout ----- | ||
----- stderr ----- | ||
Searching for Python versions matching: Python 3.13t | ||
Installed Python 3.13.0 in [TIME] | ||
+ cpython-3.13.0+freethreaded-[PLATFORM] | ||
"###); | ||
|
||
// Should be distinct from 3.13 | ||
uv_snapshot!(context.filters(), context.python_install().arg("3.13"), @r###" | ||
success: true | ||
exit_code: 0 | ||
----- stdout ----- | ||
----- stderr ----- | ||
Searching for Python versions matching: Python 3.13 | ||
Installed Python 3.13.0 in [TIME] | ||
+ cpython-3.13.0-[PLATFORM] | ||
"###); | ||
|
||
// Should not work with older Python versions | ||
uv_snapshot!(context.filters(), context.python_install().arg("3.12t"), @r###" | ||
success: false | ||
exit_code: 2 | ||
----- stdout ----- | ||
----- stderr ----- | ||
Searching for Python versions matching: Python 3.12t | ||
error: No download found for request: cpython-3.12t-[PLATFORM] | ||
"###); | ||
} |