mirror of https://github.com/astral-sh/uv
add a snapshot test for `uv pip install` with an exact Git commit
This commit is contained in:
parent
dc455bfc26
commit
9ff07c113f
|
|
@ -2111,6 +2111,55 @@ fn install_git_public_https_missing_commit() {
|
|||
"###);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(feature = "git")]
|
||||
fn install_git_public_https_exact_commit() {
|
||||
let context = TestContext::new(DEFAULT_PYTHON_VERSION);
|
||||
|
||||
// `uv pip install` a Git dependency with an exact commit.
|
||||
uv_snapshot!(context.filters(), context.pip_install()
|
||||
// Normally Updating/Updated notifications are suppressed in tests (because their order can
|
||||
// be nondeterministic), but here that's exactly what we want to test for.
|
||||
.env_remove(EnvVars::UV_TEST_NO_CLI_PROGRESS)
|
||||
// Whether fetching happens during resolution or later depends on whether the GitHub fast
|
||||
// path is taken, which isn't reliable. Disable it, so that we get a stable order of events
|
||||
// here.
|
||||
.env(EnvVars::UV_NO_GITHUB_FAST_PATH, "true")
|
||||
.arg("uv-public-pypackage @ git+https://github.com/astral-test/uv-public-pypackage@b270df1a2fb5d012294e9aaf05e7e0bab1e6a389")
|
||||
, @r"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
||||
----- stderr -----
|
||||
Updating https://github.com/astral-test/uv-public-pypackage (b270df1a2fb5d012294e9aaf05e7e0bab1e6a389)
|
||||
Updated https://github.com/astral-test/uv-public-pypackage (b270df1a2fb5d012294e9aaf05e7e0bab1e6a389)
|
||||
Resolved 1 package in [TIME]
|
||||
Building uv-public-pypackage @ git+https://github.com/astral-test/uv-public-pypackage@b270df1a2fb5d012294e9aaf05e7e0bab1e6a389
|
||||
Built uv-public-pypackage @ git+https://github.com/astral-test/uv-public-pypackage@b270df1a2fb5d012294e9aaf05e7e0bab1e6a389
|
||||
Prepared 1 package in [TIME]
|
||||
Installed 1 package in [TIME]
|
||||
+ uv-public-pypackage==0.1.0 (from git+https://github.com/astral-test/uv-public-pypackage@b270df1a2fb5d012294e9aaf05e7e0bab1e6a389)
|
||||
");
|
||||
|
||||
// Run the exact same command again, with that commit now in cache.
|
||||
uv_snapshot!(context.filters(), context.pip_install()
|
||||
.env_remove(EnvVars::UV_TEST_NO_CLI_PROGRESS)
|
||||
.env(EnvVars::UV_NO_GITHUB_FAST_PATH, "true")
|
||||
.arg("uv-public-pypackage @ git+https://github.com/astral-test/uv-public-pypackage@b270df1a2fb5d012294e9aaf05e7e0bab1e6a389")
|
||||
, @r"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
||||
----- stderr -----
|
||||
Updating https://github.com/astral-test/uv-public-pypackage (b270df1a2fb5d012294e9aaf05e7e0bab1e6a389)
|
||||
Updated https://github.com/astral-test/uv-public-pypackage (b270df1a2fb5d012294e9aaf05e7e0bab1e6a389)
|
||||
Resolved 1 package in [TIME]
|
||||
Audited 1 package in [TIME]
|
||||
");
|
||||
}
|
||||
|
||||
/// Install a package from a private GitHub repository using a PAT
|
||||
#[test]
|
||||
#[cfg(all(not(windows), feature = "git"))]
|
||||
|
|
|
|||
Loading…
Reference in New Issue