Add uv export test cases for PEP 751 format with credentials (#13810)
Same as the following, but for `pylock.toml` instead of `requirements.txt` - #13808 - #13792
This commit is contained in:
@@ -4170,3 +4170,81 @@ fn pep_751_filename() -> Result<()> {
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(feature = "git")]
|
||||
#[test]
|
||||
fn pep_751_https_git_credentials() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
let token = decode_token(READ_ONLY_GITHUB_TOKEN);
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(&formatdoc! {r#"
|
||||
[project]
|
||||
name = "project"
|
||||
version = "0.1.0"
|
||||
requires-python = ">=3.12"
|
||||
dependencies = ["uv-private-pypackage @ git+https://{token}@github.com/astral-test/uv-private-pypackage"]
|
||||
"#})?;
|
||||
|
||||
context.lock().assert().success();
|
||||
|
||||
// The token should not be included in the export
|
||||
uv_snapshot!(context.filters(), context.export().arg("--format").arg("pylock.toml"), @r#"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
# This file was autogenerated by uv via the following command:
|
||||
# uv export --cache-dir [CACHE_DIR] --format pylock.toml
|
||||
lock-version = "1.0"
|
||||
created-by = "uv"
|
||||
requires-python = ">=3.12"
|
||||
|
||||
[[packages]]
|
||||
name = "uv-private-pypackage"
|
||||
version = "0.1.0"
|
||||
vcs = { type = "git", url = "https://github.com/astral-test/uv-private-pypackage", commit-id = "d780faf0ac91257d4d5a4f0c5a0e4509608c0071" }
|
||||
|
||||
----- stderr -----
|
||||
Resolved 2 packages in [TIME]
|
||||
"#);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pep_751_https_credentials() -> Result<()> {
|
||||
let context = TestContext::new("3.12");
|
||||
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(&formatdoc! {r#"
|
||||
[project]
|
||||
name = "project"
|
||||
version = "0.1.0"
|
||||
requires-python = ">=3.12"
|
||||
dependencies = ["iniconfig @ https://public:heron@pypi-proxy.fly.dev/basic-auth/files/packages/ef/a6/62565a6e1cf69e10f5727360368e451d4b7f58beeac6173dc9db836a5b46/iniconfig-2.0.0-py3-none-any.whl"]
|
||||
"#})?;
|
||||
|
||||
context.lock().assert().success();
|
||||
|
||||
// The credentials are for a direct URL, and are included in the export
|
||||
uv_snapshot!(context.filters(), context.export().arg("--format").arg("pylock.toml"), @r#"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
# This file was autogenerated by uv via the following command:
|
||||
# uv export --cache-dir [CACHE_DIR] --format pylock.toml
|
||||
lock-version = "1.0"
|
||||
created-by = "uv"
|
||||
requires-python = ">=3.12"
|
||||
|
||||
[[packages]]
|
||||
name = "iniconfig"
|
||||
version = "2.0.0"
|
||||
archive = { url = "https://public:heron@pypi-proxy.fly.dev/basic-auth/files/packages/ef/a6/62565a6e1cf69e10f5727360368e451d4b7f58beeac6173dc9db836a5b46/iniconfig-2.0.0-py3-none-any.whl", hashes = { sha256 = "b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374" } }
|
||||
|
||||
----- stderr -----
|
||||
Resolved 2 packages in [TIME]
|
||||
"#);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user