Skip to content

Commit

Permalink
Add an error case for --no-binary sync failures (#9025)
Browse files Browse the repository at this point in the history
  • Loading branch information
charliermarsh authored Nov 11, 2024
1 parent 58bc604 commit a3c2a36
Showing 1 changed file with 44 additions and 4 deletions.
48 changes: 44 additions & 4 deletions crates/uv/tests/it/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2857,6 +2857,8 @@ fn no_binary() -> Result<()> {
"#,
)?;

context.lock().assert().success();

uv_snapshot!(context.filters(), context.sync().arg("--no-binary-package").arg("iniconfig"), @r###"
success: true
exit_code: 0
Expand Down Expand Up @@ -2886,7 +2888,7 @@ fn no_binary_error() -> Result<()> {
name = "project"
version = "0.1.0"
requires-python = ">=3.12"
dependencies = ["django_allauth==0.51.0"]
dependencies = ["odrive"]
[build-system]
requires = ["setuptools>=42"]
Expand All @@ -2896,14 +2898,14 @@ fn no_binary_error() -> Result<()> {

context.lock().assert().success();

uv_snapshot!(context.filters(), context.sync().arg("--no-build-package").arg("django-allauth"), @r###"
uv_snapshot!(context.filters(), context.sync().arg("--no-binary-package").arg("odrive"), @r###"
success: false
exit_code: 2
----- stdout -----
----- stderr -----
Resolved 19 packages in [TIME]
error: Distribution `django-allauth==0.51.0 @ registry+https://pypi.org/simple` can't be installed because it is marked as `--no-build` but has no binary distribution
Resolved 31 packages in [TIME]
error: Distribution `odrive==0.6.8 @ registry+https://pypi.org/simple` can't be installed because it is marked as `--no-binary` but has no source distribution
"###);

assert!(context.temp_dir.child("uv.lock").exists());
Expand All @@ -2930,6 +2932,8 @@ fn no_build() -> Result<()> {
"#,
)?;

context.lock().assert().success();

uv_snapshot!(context.filters(), context.sync().arg("--no-build-package").arg("iniconfig"), @r###"
success: true
exit_code: 0
Expand All @@ -2948,6 +2952,42 @@ fn no_build() -> Result<()> {
Ok(())
}

#[test]
fn no_build_error() -> Result<()> {
let context = TestContext::new("3.12");

let pyproject_toml = context.temp_dir.child("pyproject.toml");
pyproject_toml.write_str(
r#"
[project]
name = "project"
version = "0.1.0"
requires-python = ">=3.12"
dependencies = ["django_allauth==0.51.0"]
[build-system]
requires = ["setuptools>=42"]
build-backend = "setuptools.build_meta"
"#,
)?;

context.lock().assert().success();

uv_snapshot!(context.filters(), context.sync().arg("--no-build-package").arg("django-allauth"), @r###"
success: false
exit_code: 2
----- stdout -----
----- stderr -----
Resolved 19 packages in [TIME]
error: Distribution `django-allauth==0.51.0 @ registry+https://pypi.org/simple` can't be installed because it is marked as `--no-build` but has no binary distribution
"###);

assert!(context.temp_dir.child("uv.lock").exists());

Ok(())
}

#[test]
fn sync_wheel_url_source_error() -> Result<()> {
let context = TestContext::new("3.12");
Expand Down

0 comments on commit a3c2a36

Please sign in to comment.