Improve test behavior with custom installation directory (#10048)
## Summary Testing with `UV_PYTHON_INSTALL_DIR` environment variable has some problems. This PR fix them. - `UV_PYTHON_INSTALL_DIR` must be an absolute path. - Cargo tries to find Python executables from each crates in test. If it is relative path, cargo searches in different directories for each tests. - Skip the test asserting help messages. - Clap shows the current value of the environment variables. If `UV_PYTHON_INSTALL_DIR` is set, the test fails. ## Test Plan <!-- How was it tested? --> All tests pass with `UV_PYTHON_INSTALL_DIR=/path/to/my/home/uv/target/testpython`.
This commit is contained in:
+1
-1
@@ -47,7 +47,7 @@ Testing uv requires multiple specific Python versions; they can be installed wit
|
||||
cargo run python install
|
||||
```
|
||||
|
||||
The storage directory can be configured with `UV_PYTHON_INSTALL_DIR`.
|
||||
The storage directory can be configured with `UV_PYTHON_INSTALL_DIR`. (It must be an absolute path.)
|
||||
|
||||
### Snapshot testing
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
use uv_static::EnvVars;
|
||||
|
||||
use crate::common::{uv_snapshot, TestContext};
|
||||
|
||||
#[test]
|
||||
@@ -452,7 +454,7 @@ fn help_subcommand() {
|
||||
fn help_subsubcommand() {
|
||||
let context = TestContext::new_with_versions(&[]);
|
||||
|
||||
uv_snapshot!(context.filters(), context.help().arg("python").arg("install"), @r###"
|
||||
uv_snapshot!(context.filters(), context.help().env_remove(EnvVars::UV_PYTHON_INSTALL_DIR).arg("python").arg("install"), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
||||
Reference in New Issue
Block a user