mirror of https://github.com/astral-sh/uv
Universal sync_required_environment_hint test (#13975)
Use the packse case `no-sdist-no-wheels-with-matching-platform` for a platform independent `sync_required_environment_hint` test. Fixes #13890
This commit is contained in:
parent
81aebf921d
commit
b3d7f79770
|
|
@ -4,7 +4,7 @@ use assert_fs::{fixture::ChildPath, prelude::*};
|
||||||
use indoc::{formatdoc, indoc};
|
use indoc::{formatdoc, indoc};
|
||||||
use insta::assert_snapshot;
|
use insta::assert_snapshot;
|
||||||
|
|
||||||
use crate::common::{TestContext, download_to_disk, uv_snapshot, venv_bin_path};
|
use crate::common::{TestContext, download_to_disk, packse_index_url, uv_snapshot, venv_bin_path};
|
||||||
use predicates::prelude::predicate;
|
use predicates::prelude::predicate;
|
||||||
use tempfile::tempdir_in;
|
use tempfile::tempdir_in;
|
||||||
use uv_fs::Simplified;
|
use uv_fs::Simplified;
|
||||||
|
|
@ -9609,45 +9609,27 @@ fn direct_url_dependency_metadata() -> Result<()> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(unix)]
|
|
||||||
#[test]
|
#[test]
|
||||||
fn sync_required_environment_hint() -> Result<()> {
|
fn sync_required_environment_hint() -> Result<()> {
|
||||||
let context = TestContext::new("3.13");
|
let context = TestContext::new("3.13");
|
||||||
|
|
||||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||||
pyproject_toml.write_str(
|
pyproject_toml.write_str(&formatdoc! {r#"
|
||||||
r#"
|
|
||||||
[project]
|
[project]
|
||||||
name = "example"
|
name = "example"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
requires-python = ">=3.13.2"
|
requires-python = ">=3.13.2"
|
||||||
dependencies = ["wheel_tag_test"]
|
dependencies = ["no-sdist-no-wheels-with-matching-platform-a"]
|
||||||
|
|
||||||
|
[[tool.uv.index]]
|
||||||
|
name = "packse"
|
||||||
|
url = "{}"
|
||||||
|
default = true
|
||||||
"#,
|
"#,
|
||||||
)?;
|
packse_index_url()
|
||||||
|
})?;
|
||||||
|
|
||||||
// Populate the `--find-links` entries.
|
uv_snapshot!(context.filters(), context.lock().env_remove("UV_EXCLUDE_NEWER"), @r"
|
||||||
fs_err::create_dir_all(context.temp_dir.join("links"))?;
|
|
||||||
|
|
||||||
for entry in fs_err::read_dir(context.workspace_root.join("scripts/links"))? {
|
|
||||||
let entry = entry?;
|
|
||||||
let path = entry.path();
|
|
||||||
if path
|
|
||||||
.file_name()
|
|
||||||
.and_then(|file_name| file_name.to_str())
|
|
||||||
.is_some_and(|file_name| file_name.starts_with("wheel_tag_test-"))
|
|
||||||
{
|
|
||||||
let dest = context
|
|
||||||
.temp_dir
|
|
||||||
.join("links")
|
|
||||||
.join(path.file_name().unwrap());
|
|
||||||
fs_err::copy(&path, &dest)?;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
uv_snapshot!(context.filters(), context.lock()
|
|
||||||
.arg("--no-index")
|
|
||||||
.arg("--find-links")
|
|
||||||
.arg(context.temp_dir.join("links")), @r"
|
|
||||||
success: true
|
success: true
|
||||||
exit_code: 0
|
exit_code: 0
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
|
|
@ -9657,21 +9639,21 @@ fn sync_required_environment_hint() -> Result<()> {
|
||||||
");
|
");
|
||||||
|
|
||||||
let mut filters = context.filters();
|
let mut filters = context.filters();
|
||||||
filters.push((r"(macOS|Linux) \(`.*`\)", "[PLATFORM] (`[TAG]`)"));
|
filters.push((
|
||||||
|
r"You're on [^ ]+ \(`.*`\)",
|
||||||
|
"You're on [PLATFORM] (`[TAG]`)",
|
||||||
|
));
|
||||||
|
|
||||||
uv_snapshot!(filters, context.sync()
|
uv_snapshot!(filters, context.sync().env_remove("UV_EXCLUDE_NEWER"), @r"
|
||||||
.arg("--no-index")
|
|
||||||
.arg("--find-links")
|
|
||||||
.arg(context.temp_dir.join("links")), @r"
|
|
||||||
success: false
|
success: false
|
||||||
exit_code: 2
|
exit_code: 2
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
|
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
Resolved 2 packages in [TIME]
|
Resolved 2 packages in [TIME]
|
||||||
error: Distribution `wheel-tag-test==0.1.0 @ registry+links` can't be installed because it doesn't have a source distribution or wheel for the current platform
|
error: Distribution `no-sdist-no-wheels-with-matching-platform-a==1.0.0 @ registry+https://astral-sh.github.io/packse/PACKSE_VERSION/simple-html/` can't be installed because it doesn't have a source distribution or wheel for the current platform
|
||||||
|
|
||||||
hint: You're on [PLATFORM] (`[TAG]`), but `wheel-tag-test` (v0.1.0) only has wheels for the following platform: `win_amd64`; consider adding your platform to `tool.uv.required-environments` to ensure uv resolves to a version with compatible wheels
|
hint: You're on [PLATFORM] (`[TAG]`), but `no-sdist-no-wheels-with-matching-platform-a` (v1.0.0) only has wheels for the following platform: `macosx_10_0_ppc64`; consider adding your platform to `tool.uv.required-environments` to ensure uv resolves to a version with compatible wheels
|
||||||
");
|
");
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue