mirror of https://github.com/astral-sh/uv
make `--check` outdated a non-error status 1 (#14167)
In the case of `uv sync` all we really need to do is handle the `OutdatedEnvironment` error (precisely the error we yield only on dry-runs when everything Works but we determine things are outdated) in `OperationDiagnostic::report` (the post-processor on all `operations::install` calls) because any diagnostic handled by that gets downgraded to from status 2 to status 1 (although I don't know if that's really intentional or a random other bug in our status handling... but I figured it's best to highlight that other potential status code incongruence than not rely on it 😄). Fixes #12603 --------- Co-authored-by: John Mumm <jtfmumm@gmail.com>
This commit is contained in:
parent
6df7dab2df
commit
2850dc0599
|
|
@ -127,6 +127,10 @@ impl OperationDiagnostic {
|
||||||
native_tls_hint(err);
|
native_tls_hint(err);
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
pip::operations::Error::OutdatedEnvironment => {
|
||||||
|
anstream::eprint!("{}", err);
|
||||||
|
None
|
||||||
|
}
|
||||||
err => Some(err),
|
err => Some(err),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -234,6 +234,10 @@ pub(crate) async fn lock(
|
||||||
|
|
||||||
Ok(ExitStatus::Success)
|
Ok(ExitStatus::Success)
|
||||||
}
|
}
|
||||||
|
Err(err @ ProjectError::LockMismatch(..)) => {
|
||||||
|
writeln!(printer.stderr(), "{}", err.to_string().bold())?;
|
||||||
|
Ok(ExitStatus::Failure)
|
||||||
|
}
|
||||||
Err(ProjectError::Operation(err)) => {
|
Err(ProjectError::Operation(err)) => {
|
||||||
diagnostics::OperationDiagnostic::native_tls(network_settings.native_tls)
|
diagnostics::OperationDiagnostic::native_tls(network_settings.native_tls)
|
||||||
.report(err)
|
.report(err)
|
||||||
|
|
@ -346,8 +350,11 @@ impl<'env> LockOperation<'env> {
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
// If the lockfile changed, return an error.
|
// If the lockfile changed, return an error.
|
||||||
if matches!(result, LockResult::Changed(_, _)) {
|
if let LockResult::Changed(prev, cur) = result {
|
||||||
return Err(ProjectError::LockMismatch(Box::new(result.into_lock())));
|
return Err(ProjectError::LockMismatch(
|
||||||
|
prev.map(Box::new),
|
||||||
|
Box::new(cur),
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(result)
|
Ok(result)
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ pub(crate) enum ProjectError {
|
||||||
#[error(
|
#[error(
|
||||||
"The lockfile at `uv.lock` needs to be updated, but `--locked` was provided. To update the lockfile, run `uv lock`."
|
"The lockfile at `uv.lock` needs to be updated, but `--locked` was provided. To update the lockfile, run `uv lock`."
|
||||||
)]
|
)]
|
||||||
LockMismatch(Box<Lock>),
|
LockMismatch(Option<Box<Lock>>, Box<Lock>),
|
||||||
|
|
||||||
#[error(
|
#[error(
|
||||||
"Unable to find lockfile at `uv.lock`. To create a lockfile, run `uv lock` or `uv sync`."
|
"Unable to find lockfile at `uv.lock`. To create a lockfile, run `uv lock` or `uv sync`."
|
||||||
|
|
|
||||||
|
|
@ -330,10 +330,19 @@ pub(crate) async fn sync(
|
||||||
.report(err)
|
.report(err)
|
||||||
.map_or(Ok(ExitStatus::Failure), |err| Err(err.into()));
|
.map_or(Ok(ExitStatus::Failure), |err| Err(err.into()));
|
||||||
}
|
}
|
||||||
Err(ProjectError::LockMismatch(lock)) if dry_run.enabled() => {
|
Err(ProjectError::LockMismatch(prev, cur)) => {
|
||||||
// The lockfile is mismatched, but we're in dry-run mode. We should proceed with the
|
if dry_run.enabled() {
|
||||||
// sync operation, but exit with a non-zero status.
|
// The lockfile is mismatched, but we're in dry-run mode. We should proceed with the
|
||||||
Outcome::LockMismatch(lock)
|
// sync operation, but exit with a non-zero status.
|
||||||
|
Outcome::LockMismatch(prev, cur)
|
||||||
|
} else {
|
||||||
|
writeln!(
|
||||||
|
printer.stderr(),
|
||||||
|
"{}",
|
||||||
|
ProjectError::LockMismatch(prev, cur).to_string().bold()
|
||||||
|
)?;
|
||||||
|
return Ok(ExitStatus::Failure);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Err(err) => return Err(err.into()),
|
Err(err) => return Err(err.into()),
|
||||||
};
|
};
|
||||||
|
|
@ -398,7 +407,14 @@ pub(crate) async fn sync(
|
||||||
|
|
||||||
match outcome {
|
match outcome {
|
||||||
Outcome::Success(..) => Ok(ExitStatus::Success),
|
Outcome::Success(..) => Ok(ExitStatus::Success),
|
||||||
Outcome::LockMismatch(lock) => Err(ProjectError::LockMismatch(lock).into()),
|
Outcome::LockMismatch(prev, cur) => {
|
||||||
|
writeln!(
|
||||||
|
printer.stderr(),
|
||||||
|
"{}",
|
||||||
|
ProjectError::LockMismatch(prev, cur).to_string().bold()
|
||||||
|
)?;
|
||||||
|
Ok(ExitStatus::Failure)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -409,15 +425,18 @@ enum Outcome {
|
||||||
/// The `lock` operation was successful.
|
/// The `lock` operation was successful.
|
||||||
Success(LockResult),
|
Success(LockResult),
|
||||||
/// The `lock` operation successfully resolved, but failed due to a mismatch (e.g., with `--locked`).
|
/// The `lock` operation successfully resolved, but failed due to a mismatch (e.g., with `--locked`).
|
||||||
LockMismatch(Box<Lock>),
|
LockMismatch(Option<Box<Lock>>, Box<Lock>),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Outcome {
|
impl Outcome {
|
||||||
/// Return the [`Lock`] associated with this outcome.
|
/// Return the [`Lock`] associated with this outcome.
|
||||||
fn lock(&self) -> &Lock {
|
fn lock(&self) -> &Lock {
|
||||||
match self {
|
match self {
|
||||||
Self::Success(lock) => lock.lock(),
|
Self::Success(lock) => match lock {
|
||||||
Self::LockMismatch(lock) => lock,
|
LockResult::Changed(_, lock) => lock,
|
||||||
|
LockResult::Unchanged(lock) => lock,
|
||||||
|
},
|
||||||
|
Self::LockMismatch(_prev, cur) => cur,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1179,7 +1198,7 @@ impl From<(&LockTarget<'_>, &LockMode<'_>, &Outcome)> for LockReport {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// TODO(zanieb): We don't have a way to report the outcome of the lock yet
|
// TODO(zanieb): We don't have a way to report the outcome of the lock yet
|
||||||
Outcome::LockMismatch(_) => LockAction::Check,
|
Outcome::LockMismatch(..) => LockAction::Check,
|
||||||
},
|
},
|
||||||
dry_run: matches!(mode, LockMode::DryRun(_)),
|
dry_run: matches!(mode, LockMode::DryRun(_)),
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6660,15 +6660,15 @@ fn lock_invalid_hash() -> Result<()> {
|
||||||
"#)?;
|
"#)?;
|
||||||
|
|
||||||
// Re-run with `--locked`.
|
// Re-run with `--locked`.
|
||||||
uv_snapshot!(context.filters(), context.lock().arg("--locked"), @r###"
|
uv_snapshot!(context.filters(), context.lock().arg("--locked"), @r"
|
||||||
success: false
|
success: false
|
||||||
exit_code: 2
|
exit_code: 1
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
|
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
Resolved 4 packages in [TIME]
|
Resolved 4 packages in [TIME]
|
||||||
error: The lockfile at `uv.lock` needs to be updated, but `--locked` was provided. To update the lockfile, run `uv lock`.
|
The lockfile at `uv.lock` needs to be updated, but `--locked` was provided. To update the lockfile, run `uv lock`.
|
||||||
"###);
|
");
|
||||||
|
|
||||||
// Install from the lockfile.
|
// Install from the lockfile.
|
||||||
uv_snapshot!(context.filters(), context.sync().arg("--frozen"), @r###"
|
uv_snapshot!(context.filters(), context.sync().arg("--frozen"), @r###"
|
||||||
|
|
@ -11743,6 +11743,95 @@ fn unconditional_overlapping_marker_disjoint_version_constraints() -> Result<()>
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Checks the output of `uv lock --check` when there isn't a lock
|
||||||
|
#[test]
|
||||||
|
fn check_no_lock() -> Result<()> {
|
||||||
|
let context = TestContext::new("3.12");
|
||||||
|
|
||||||
|
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||||
|
pyproject_toml.write_str(
|
||||||
|
r#"
|
||||||
|
[project]
|
||||||
|
name = "myproject"
|
||||||
|
version = "0.1.0"
|
||||||
|
requires-python = ">=3.11"
|
||||||
|
dependencies = ["sortedcollections"]
|
||||||
|
"#,
|
||||||
|
)?;
|
||||||
|
|
||||||
|
uv_snapshot!(context.filters(), context.lock()
|
||||||
|
.arg("--check"), @r"
|
||||||
|
success: false
|
||||||
|
exit_code: 2
|
||||||
|
----- stdout -----
|
||||||
|
|
||||||
|
----- stderr -----
|
||||||
|
error: Unable to find lockfile at `uv.lock`. To create a lockfile, run `uv lock` or `uv sync`.
|
||||||
|
");
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Checks the output of `uv lock --check` when the lock is outdated
|
||||||
|
#[test]
|
||||||
|
fn check_outdated_lock() -> Result<()> {
|
||||||
|
let context = TestContext::new("3.12");
|
||||||
|
|
||||||
|
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||||
|
pyproject_toml.write_str(
|
||||||
|
r#"
|
||||||
|
[project]
|
||||||
|
name = "myproject"
|
||||||
|
version = "0.1.0"
|
||||||
|
requires-python = ">=3.11"
|
||||||
|
dependencies = ["sortedcollections"]
|
||||||
|
"#,
|
||||||
|
)?;
|
||||||
|
|
||||||
|
// Generate the lock
|
||||||
|
uv_snapshot!(context.filters(), context.lock(), @r"
|
||||||
|
success: true
|
||||||
|
exit_code: 0
|
||||||
|
----- stdout -----
|
||||||
|
|
||||||
|
----- stderr -----
|
||||||
|
Resolved 3 packages in [TIME]
|
||||||
|
");
|
||||||
|
|
||||||
|
// Check the --check returns fine
|
||||||
|
uv_snapshot!(context.filters(), context.lock()
|
||||||
|
.arg("--check"), @r"
|
||||||
|
success: true
|
||||||
|
exit_code: 0
|
||||||
|
----- stdout -----
|
||||||
|
|
||||||
|
----- stderr -----
|
||||||
|
Resolved 3 packages in [TIME]
|
||||||
|
");
|
||||||
|
|
||||||
|
// Edit dependencies so the lock is invalid
|
||||||
|
pyproject_toml.write_str(
|
||||||
|
r#"
|
||||||
|
[project]
|
||||||
|
name = "project"
|
||||||
|
version = "0.1.0"
|
||||||
|
requires-python = ">=3.11"
|
||||||
|
dependencies = ["iniconfig"]
|
||||||
|
"#,
|
||||||
|
)?;
|
||||||
|
|
||||||
|
uv_snapshot!(context.filters(), context.lock()
|
||||||
|
.arg("--check"), @r"
|
||||||
|
success: false
|
||||||
|
exit_code: 1
|
||||||
|
----- stdout -----
|
||||||
|
|
||||||
|
----- stderr -----
|
||||||
|
Resolved 2 packages in [TIME]
|
||||||
|
The lockfile at `uv.lock` needs to be updated, but `--locked` was provided. To update the lockfile, run `uv lock`.
|
||||||
|
");
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
/// This checks that markers that normalize to 'false', which are serialized
|
/// This checks that markers that normalize to 'false', which are serialized
|
||||||
/// to the lockfile as `python_full_version < '0'`, get read back as false.
|
/// to the lockfile as `python_full_version < '0'`, get read back as false.
|
||||||
/// Otherwise `uv lock --check` will always fail.
|
/// Otherwise `uv lock --check` will always fail.
|
||||||
|
|
@ -12094,15 +12183,15 @@ fn lock_remove_member() -> Result<()> {
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
// Re-run with `--locked`. This should fail.
|
// Re-run with `--locked`. This should fail.
|
||||||
uv_snapshot!(context.filters(), context.lock().arg("--locked"), @r###"
|
uv_snapshot!(context.filters(), context.lock().arg("--locked"), @r"
|
||||||
success: false
|
success: false
|
||||||
exit_code: 2
|
exit_code: 1
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
|
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
Resolved 1 package in [TIME]
|
Resolved 1 package in [TIME]
|
||||||
error: The lockfile at `uv.lock` needs to be updated, but `--locked` was provided. To update the lockfile, run `uv lock`.
|
The lockfile at `uv.lock` needs to be updated, but `--locked` was provided. To update the lockfile, run `uv lock`.
|
||||||
"###);
|
");
|
||||||
|
|
||||||
// Re-run without `--locked`.
|
// Re-run without `--locked`.
|
||||||
uv_snapshot!(context.filters(), context.lock(), @r###"
|
uv_snapshot!(context.filters(), context.lock(), @r###"
|
||||||
|
|
@ -12239,15 +12328,15 @@ fn lock_add_member() -> Result<()> {
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
// Re-run with `--locked`. This should fail.
|
// Re-run with `--locked`. This should fail.
|
||||||
uv_snapshot!(context.filters(), context.lock().arg("--locked"), @r###"
|
uv_snapshot!(context.filters(), context.lock().arg("--locked"), @r"
|
||||||
success: false
|
success: false
|
||||||
exit_code: 2
|
exit_code: 1
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
|
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
Resolved 5 packages in [TIME]
|
Resolved 5 packages in [TIME]
|
||||||
error: The lockfile at `uv.lock` needs to be updated, but `--locked` was provided. To update the lockfile, run `uv lock`.
|
The lockfile at `uv.lock` needs to be updated, but `--locked` was provided. To update the lockfile, run `uv lock`.
|
||||||
"###);
|
");
|
||||||
|
|
||||||
// Re-run with `--offline`. This should also fail, during the resolve phase.
|
// Re-run with `--offline`. This should also fail, during the resolve phase.
|
||||||
uv_snapshot!(context.filters(), context.lock().arg("--locked").arg("--offline").arg("--no-cache"), @r###"
|
uv_snapshot!(context.filters(), context.lock().arg("--locked").arg("--offline").arg("--no-cache"), @r###"
|
||||||
|
|
@ -12476,15 +12565,15 @@ fn lock_redundant_add_member() -> Result<()> {
|
||||||
|
|
||||||
// Re-run with `--locked`. This will fail, though in theory it could succeed, since the current
|
// Re-run with `--locked`. This will fail, though in theory it could succeed, since the current
|
||||||
// _resolution_ satisfies the requirements, even if the inputs are not identical
|
// _resolution_ satisfies the requirements, even if the inputs are not identical
|
||||||
uv_snapshot!(context.filters(), context.lock().arg("--locked"), @r###"
|
uv_snapshot!(context.filters(), context.lock().arg("--locked"), @r"
|
||||||
success: false
|
success: false
|
||||||
exit_code: 2
|
exit_code: 1
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
|
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
Resolved 4 packages in [TIME]
|
Resolved 4 packages in [TIME]
|
||||||
error: The lockfile at `uv.lock` needs to be updated, but `--locked` was provided. To update the lockfile, run `uv lock`.
|
The lockfile at `uv.lock` needs to be updated, but `--locked` was provided. To update the lockfile, run `uv lock`.
|
||||||
"###);
|
");
|
||||||
|
|
||||||
// Re-run without `--locked`.
|
// Re-run without `--locked`.
|
||||||
uv_snapshot!(context.filters(), context.lock(), @r###"
|
uv_snapshot!(context.filters(), context.lock(), @r###"
|
||||||
|
|
@ -12674,15 +12763,15 @@ fn lock_new_constraints() -> Result<()> {
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
// Re-run with `--locked`. This should fail.
|
// Re-run with `--locked`. This should fail.
|
||||||
uv_snapshot!(context.filters(), context.lock().arg("--locked"), @r###"
|
uv_snapshot!(context.filters(), context.lock().arg("--locked"), @r"
|
||||||
success: false
|
success: false
|
||||||
exit_code: 2
|
exit_code: 1
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
|
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
Resolved 4 packages in [TIME]
|
Resolved 4 packages in [TIME]
|
||||||
error: The lockfile at `uv.lock` needs to be updated, but `--locked` was provided. To update the lockfile, run `uv lock`.
|
The lockfile at `uv.lock` needs to be updated, but `--locked` was provided. To update the lockfile, run `uv lock`.
|
||||||
"###);
|
");
|
||||||
|
|
||||||
// Re-run without `--locked`.
|
// Re-run without `--locked`.
|
||||||
uv_snapshot!(context.filters(), context.lock(), @r###"
|
uv_snapshot!(context.filters(), context.lock(), @r###"
|
||||||
|
|
@ -12883,16 +12972,16 @@ fn lock_remove_member_non_project() -> Result<()> {
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
// Re-run with `--locked`. This should fail.
|
// Re-run with `--locked`. This should fail.
|
||||||
uv_snapshot!(context.filters(), context.lock().arg("--locked"), @r###"
|
uv_snapshot!(context.filters(), context.lock().arg("--locked"), @r"
|
||||||
success: false
|
success: false
|
||||||
exit_code: 2
|
exit_code: 1
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
|
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
warning: No `requires-python` value found in the workspace. Defaulting to `>=3.12`.
|
warning: No `requires-python` value found in the workspace. Defaulting to `>=3.12`.
|
||||||
Resolved in [TIME]
|
Resolved in [TIME]
|
||||||
error: The lockfile at `uv.lock` needs to be updated, but `--locked` was provided. To update the lockfile, run `uv lock`.
|
The lockfile at `uv.lock` needs to be updated, but `--locked` was provided. To update the lockfile, run `uv lock`.
|
||||||
"###);
|
");
|
||||||
|
|
||||||
// Re-run without `--locked`.
|
// Re-run without `--locked`.
|
||||||
uv_snapshot!(context.filters(), context.lock(), @r###"
|
uv_snapshot!(context.filters(), context.lock(), @r###"
|
||||||
|
|
@ -13015,15 +13104,15 @@ fn lock_rename_project() -> Result<()> {
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
// Re-run with `--locked`. This should fail.
|
// Re-run with `--locked`. This should fail.
|
||||||
uv_snapshot!(context.filters(), context.lock().arg("--locked"), @r###"
|
uv_snapshot!(context.filters(), context.lock().arg("--locked"), @r"
|
||||||
success: false
|
success: false
|
||||||
exit_code: 2
|
exit_code: 1
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
|
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
Resolved 2 packages in [TIME]
|
Resolved 2 packages in [TIME]
|
||||||
error: The lockfile at `uv.lock` needs to be updated, but `--locked` was provided. To update the lockfile, run `uv lock`.
|
The lockfile at `uv.lock` needs to be updated, but `--locked` was provided. To update the lockfile, run `uv lock`.
|
||||||
"###);
|
");
|
||||||
|
|
||||||
// Re-run without `--locked`.
|
// Re-run without `--locked`.
|
||||||
uv_snapshot!(context.filters(), context.lock(), @r###"
|
uv_snapshot!(context.filters(), context.lock(), @r###"
|
||||||
|
|
@ -14015,15 +14104,15 @@ fn lock_constrained_environment() -> Result<()> {
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
// Re-run with `--locked`. This should fail.
|
// Re-run with `--locked`. This should fail.
|
||||||
uv_snapshot!(context.filters(), context.lock().arg("--locked"), @r###"
|
uv_snapshot!(context.filters(), context.lock().arg("--locked"), @r"
|
||||||
success: false
|
success: false
|
||||||
exit_code: 2
|
exit_code: 1
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
|
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
Resolved 8 packages in [TIME]
|
Resolved 8 packages in [TIME]
|
||||||
error: The lockfile at `uv.lock` needs to be updated, but `--locked` was provided. To update the lockfile, run `uv lock`.
|
The lockfile at `uv.lock` needs to be updated, but `--locked` was provided. To update the lockfile, run `uv lock`.
|
||||||
"###);
|
");
|
||||||
|
|
||||||
uv_snapshot!(context.filters(), context.lock(), @r###"
|
uv_snapshot!(context.filters(), context.lock(), @r###"
|
||||||
success: true
|
success: true
|
||||||
|
|
@ -15278,15 +15367,15 @@ fn lock_add_empty_dependency_group() -> Result<()> {
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
// Re-run with `--locked`; this should fail.
|
// Re-run with `--locked`; this should fail.
|
||||||
uv_snapshot!(context.filters(), context.lock().arg("--locked"), @r###"
|
uv_snapshot!(context.filters(), context.lock().arg("--locked"), @r"
|
||||||
success: false
|
success: false
|
||||||
exit_code: 2
|
exit_code: 1
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
|
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
Resolved 2 packages in [TIME]
|
Resolved 2 packages in [TIME]
|
||||||
error: The lockfile at `uv.lock` needs to be updated, but `--locked` was provided. To update the lockfile, run `uv lock`.
|
The lockfile at `uv.lock` needs to be updated, but `--locked` was provided. To update the lockfile, run `uv lock`.
|
||||||
"###);
|
");
|
||||||
|
|
||||||
// Re-lock the project.
|
// Re-lock the project.
|
||||||
uv_snapshot!(context.filters(), context.lock(), @r###"
|
uv_snapshot!(context.filters(), context.lock(), @r###"
|
||||||
|
|
@ -15360,15 +15449,15 @@ fn lock_add_empty_dependency_group() -> Result<()> {
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
// Re-run with `--locked`; this should fail.
|
// Re-run with `--locked`; this should fail.
|
||||||
uv_snapshot!(context.filters(), context.lock().arg("--locked"), @r###"
|
uv_snapshot!(context.filters(), context.lock().arg("--locked"), @r"
|
||||||
success: false
|
success: false
|
||||||
exit_code: 2
|
exit_code: 1
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
|
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
Resolved 2 packages in [TIME]
|
Resolved 2 packages in [TIME]
|
||||||
error: The lockfile at `uv.lock` needs to be updated, but `--locked` was provided. To update the lockfile, run `uv lock`.
|
The lockfile at `uv.lock` needs to be updated, but `--locked` was provided. To update the lockfile, run `uv lock`.
|
||||||
"###);
|
");
|
||||||
|
|
||||||
// Re-lock the project.
|
// Re-lock the project.
|
||||||
uv_snapshot!(context.filters(), context.lock(), @r###"
|
uv_snapshot!(context.filters(), context.lock(), @r###"
|
||||||
|
|
@ -23253,15 +23342,15 @@ fn lock_dynamic_to_static() -> Result<()> {
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
// Rerunning with `--locked` should fail, since the project is no longer dynamic.
|
// Rerunning with `--locked` should fail, since the project is no longer dynamic.
|
||||||
uv_snapshot!(context.filters(), context.lock().arg("--locked"), @r###"
|
uv_snapshot!(context.filters(), context.lock().arg("--locked"), @r"
|
||||||
success: false
|
success: false
|
||||||
exit_code: 2
|
exit_code: 1
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
|
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
Resolved 1 package in [TIME]
|
Resolved 1 package in [TIME]
|
||||||
error: The lockfile at `uv.lock` needs to be updated, but `--locked` was provided. To update the lockfile, run `uv lock`.
|
The lockfile at `uv.lock` needs to be updated, but `--locked` was provided. To update the lockfile, run `uv lock`.
|
||||||
"###);
|
");
|
||||||
|
|
||||||
uv_snapshot!(context.filters(), context.lock(), @r###"
|
uv_snapshot!(context.filters(), context.lock(), @r###"
|
||||||
success: true
|
success: true
|
||||||
|
|
@ -23384,15 +23473,15 @@ fn lock_static_to_dynamic() -> Result<()> {
|
||||||
.write_str("__version__ = '0.1.0'")?;
|
.write_str("__version__ = '0.1.0'")?;
|
||||||
|
|
||||||
// Rerunning with `--locked` should fail, since the project is no longer static.
|
// Rerunning with `--locked` should fail, since the project is no longer static.
|
||||||
uv_snapshot!(context.filters(), context.lock().arg("--locked"), @r###"
|
uv_snapshot!(context.filters(), context.lock().arg("--locked"), @r"
|
||||||
success: false
|
success: false
|
||||||
exit_code: 2
|
exit_code: 1
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
|
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
Resolved 1 package in [TIME]
|
Resolved 1 package in [TIME]
|
||||||
error: The lockfile at `uv.lock` needs to be updated, but `--locked` was provided. To update the lockfile, run `uv lock`.
|
The lockfile at `uv.lock` needs to be updated, but `--locked` was provided. To update the lockfile, run `uv lock`.
|
||||||
"###);
|
");
|
||||||
|
|
||||||
uv_snapshot!(context.filters(), context.lock(), @r###"
|
uv_snapshot!(context.filters(), context.lock(), @r###"
|
||||||
success: true
|
success: true
|
||||||
|
|
@ -23486,15 +23575,15 @@ fn lock_bump_static_version() -> Result<()> {
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
// Rerunning with `--locked` should fail.
|
// Rerunning with `--locked` should fail.
|
||||||
uv_snapshot!(context.filters(), context.lock().arg("--locked"), @r###"
|
uv_snapshot!(context.filters(), context.lock().arg("--locked"), @r"
|
||||||
success: false
|
success: false
|
||||||
exit_code: 2
|
exit_code: 1
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
|
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
Resolved 1 package in [TIME]
|
Resolved 1 package in [TIME]
|
||||||
error: The lockfile at `uv.lock` needs to be updated, but `--locked` was provided. To update the lockfile, run `uv lock`.
|
The lockfile at `uv.lock` needs to be updated, but `--locked` was provided. To update the lockfile, run `uv lock`.
|
||||||
"###);
|
");
|
||||||
|
|
||||||
uv_snapshot!(context.filters(), context.lock(), @r###"
|
uv_snapshot!(context.filters(), context.lock(), @r###"
|
||||||
success: true
|
success: true
|
||||||
|
|
@ -25302,15 +25391,15 @@ fn lock_script() -> Result<()> {
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
// Re-run with `--locked`.
|
// Re-run with `--locked`.
|
||||||
uv_snapshot!(context.filters(), context.lock().arg("--script").arg("script.py").arg("--locked"), @r###"
|
uv_snapshot!(context.filters(), context.lock().arg("--script").arg("script.py").arg("--locked"), @r"
|
||||||
success: false
|
success: false
|
||||||
exit_code: 2
|
exit_code: 1
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
|
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
Resolved 4 packages in [TIME]
|
Resolved 4 packages in [TIME]
|
||||||
error: The lockfile at `uv.lock` needs to be updated, but `--locked` was provided. To update the lockfile, run `uv lock`.
|
The lockfile at `uv.lock` needs to be updated, but `--locked` was provided. To update the lockfile, run `uv lock`.
|
||||||
"###);
|
");
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
@ -27631,15 +27720,15 @@ fn lock_empty_extra() -> Result<()> {
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
// Re-run with `--locked`. We expect this to fail, since we've added an extra.
|
// Re-run with `--locked`. We expect this to fail, since we've added an extra.
|
||||||
uv_snapshot!(context.filters(), context.lock().arg("--locked"), @r###"
|
uv_snapshot!(context.filters(), context.lock().arg("--locked"), @r"
|
||||||
success: false
|
success: false
|
||||||
exit_code: 2
|
exit_code: 1
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
|
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
Resolved 3 packages in [TIME]
|
Resolved 3 packages in [TIME]
|
||||||
error: The lockfile at `uv.lock` needs to be updated, but `--locked` was provided. To update the lockfile, run `uv lock`.
|
The lockfile at `uv.lock` needs to be updated, but `--locked` was provided. To update the lockfile, run `uv lock`.
|
||||||
"###);
|
");
|
||||||
|
|
||||||
uv_snapshot!(context.filters(), context.lock(), @r###"
|
uv_snapshot!(context.filters(), context.lock(), @r###"
|
||||||
success: true
|
success: true
|
||||||
|
|
@ -27667,15 +27756,15 @@ fn lock_empty_extra() -> Result<()> {
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
// Re-run with `--locked`. We expect this to fail, since we've added an extra.
|
// Re-run with `--locked`. We expect this to fail, since we've added an extra.
|
||||||
uv_snapshot!(context.filters(), context.lock().arg("--locked"), @r###"
|
uv_snapshot!(context.filters(), context.lock().arg("--locked"), @r"
|
||||||
success: false
|
success: false
|
||||||
exit_code: 2
|
exit_code: 1
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
|
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
Resolved 3 packages in [TIME]
|
Resolved 3 packages in [TIME]
|
||||||
error: The lockfile at `uv.lock` needs to be updated, but `--locked` was provided. To update the lockfile, run `uv lock`.
|
The lockfile at `uv.lock` needs to be updated, but `--locked` was provided. To update the lockfile, run `uv lock`.
|
||||||
"###);
|
");
|
||||||
|
|
||||||
uv_snapshot!(context.filters(), context.lock(), @r###"
|
uv_snapshot!(context.filters(), context.lock(), @r###"
|
||||||
success: true
|
success: true
|
||||||
|
|
@ -28341,12 +28430,12 @@ fn lock_trailing_slash_index_url_in_pyproject_not_index_argument() -> Result<()>
|
||||||
// Re-run with `--locked`.
|
// Re-run with `--locked`.
|
||||||
uv_snapshot!(context.filters(), context.lock().arg("--locked"), @r"
|
uv_snapshot!(context.filters(), context.lock().arg("--locked"), @r"
|
||||||
success: false
|
success: false
|
||||||
exit_code: 2
|
exit_code: 1
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
|
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
Resolved 4 packages in [TIME]
|
Resolved 4 packages in [TIME]
|
||||||
error: The lockfile at `uv.lock` needs to be updated, but `--locked` was provided. To update the lockfile, run `uv lock`.
|
The lockfile at `uv.lock` needs to be updated, but `--locked` was provided. To update the lockfile, run `uv lock`.
|
||||||
");
|
");
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
@ -28432,12 +28521,12 @@ fn lock_trailing_slash_index_url_in_lockfile_not_pyproject() -> Result<()> {
|
||||||
// Run `uv lock --locked`.
|
// Run `uv lock --locked`.
|
||||||
uv_snapshot!(context.filters(), context.lock().arg("--locked"), @r"
|
uv_snapshot!(context.filters(), context.lock().arg("--locked"), @r"
|
||||||
success: false
|
success: false
|
||||||
exit_code: 2
|
exit_code: 1
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
|
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
Resolved 4 packages in [TIME]
|
Resolved 4 packages in [TIME]
|
||||||
error: The lockfile at `uv.lock` needs to be updated, but `--locked` was provided. To update the lockfile, run `uv lock`.
|
The lockfile at `uv.lock` needs to be updated, but `--locked` was provided. To update the lockfile, run `uv lock`.
|
||||||
");
|
");
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
@ -28523,12 +28612,12 @@ fn lock_trailing_slash_index_url_in_pyproject_and_not_lockfile() -> Result<()> {
|
||||||
// Run `uv lock --locked`.
|
// Run `uv lock --locked`.
|
||||||
uv_snapshot!(context.filters(), context.lock().arg("--locked"), @r"
|
uv_snapshot!(context.filters(), context.lock().arg("--locked"), @r"
|
||||||
success: false
|
success: false
|
||||||
exit_code: 2
|
exit_code: 1
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
|
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
Resolved 4 packages in [TIME]
|
Resolved 4 packages in [TIME]
|
||||||
error: The lockfile at `uv.lock` needs to be updated, but `--locked` was provided. To update the lockfile, run `uv lock`.
|
The lockfile at `uv.lock` needs to be updated, but `--locked` was provided. To update the lockfile, run `uv lock`.
|
||||||
");
|
");
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
@ -28714,12 +28803,12 @@ fn lock_trailing_slash_find_links() -> Result<()> {
|
||||||
// Re-run with `--locked`
|
// Re-run with `--locked`
|
||||||
uv_snapshot!(context.filters(), context.lock().arg("--locked"), @r"
|
uv_snapshot!(context.filters(), context.lock().arg("--locked"), @r"
|
||||||
success: false
|
success: false
|
||||||
exit_code: 2
|
exit_code: 1
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
|
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
Resolved 2 packages in [TIME]
|
Resolved 2 packages in [TIME]
|
||||||
error: The lockfile at `uv.lock` needs to be updated, but `--locked` was provided. To update the lockfile, run `uv lock`.
|
The lockfile at `uv.lock` needs to be updated, but `--locked` was provided. To update the lockfile, run `uv lock`.
|
||||||
");
|
");
|
||||||
|
|
||||||
uv_snapshot!(context.filters(), context.lock(), @r"
|
uv_snapshot!(context.filters(), context.lock(), @r"
|
||||||
|
|
|
||||||
|
|
@ -88,12 +88,12 @@ fn locked() -> Result<()> {
|
||||||
// Running with `--locked` should error.
|
// Running with `--locked` should error.
|
||||||
uv_snapshot!(context.filters(), context.sync().arg("--locked"), @r"
|
uv_snapshot!(context.filters(), context.sync().arg("--locked"), @r"
|
||||||
success: false
|
success: false
|
||||||
exit_code: 2
|
exit_code: 1
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
|
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
Resolved 2 packages in [TIME]
|
Resolved 2 packages in [TIME]
|
||||||
error: The lockfile at `uv.lock` needs to be updated, but `--locked` was provided. To update the lockfile, run `uv lock`.
|
The lockfile at `uv.lock` needs to be updated, but `--locked` was provided. To update the lockfile, run `uv lock`.
|
||||||
");
|
");
|
||||||
|
|
||||||
let updated = context.read("uv.lock");
|
let updated = context.read("uv.lock");
|
||||||
|
|
@ -424,12 +424,12 @@ fn sync_json() -> Result<()> {
|
||||||
.arg("--locked")
|
.arg("--locked")
|
||||||
.arg("--output-format").arg("json"), @r"
|
.arg("--output-format").arg("json"), @r"
|
||||||
success: false
|
success: false
|
||||||
exit_code: 2
|
exit_code: 1
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
|
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
Resolved 2 packages in [TIME]
|
Resolved 2 packages in [TIME]
|
||||||
error: The lockfile at `uv.lock` needs to be updated, but `--locked` was provided. To update the lockfile, run `uv lock`.
|
The lockfile at `uv.lock` needs to be updated, but `--locked` was provided. To update the lockfile, run `uv lock`.
|
||||||
");
|
");
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
@ -894,7 +894,7 @@ fn check() -> Result<()> {
|
||||||
// Running `uv sync --check` should fail.
|
// Running `uv sync --check` should fail.
|
||||||
uv_snapshot!(context.filters(), context.sync().arg("--check"), @r"
|
uv_snapshot!(context.filters(), context.sync().arg("--check"), @r"
|
||||||
success: false
|
success: false
|
||||||
exit_code: 2
|
exit_code: 1
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
|
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
|
|
@ -904,7 +904,7 @@ fn check() -> Result<()> {
|
||||||
Would download 1 package
|
Would download 1 package
|
||||||
Would install 1 package
|
Would install 1 package
|
||||||
+ iniconfig==2.0.0
|
+ iniconfig==2.0.0
|
||||||
error: The environment is outdated; run `uv sync` to update the environment
|
The environment is outdated; run `uv sync` to update the environment
|
||||||
");
|
");
|
||||||
|
|
||||||
// Sync the environment.
|
// Sync the environment.
|
||||||
|
|
@ -8626,7 +8626,7 @@ fn sync_dry_run_and_locked() -> Result<()> {
|
||||||
// Running with `--locked` and `--dry-run` should error.
|
// Running with `--locked` and `--dry-run` should error.
|
||||||
uv_snapshot!(context.filters(), context.sync().arg("--locked").arg("--dry-run"), @r"
|
uv_snapshot!(context.filters(), context.sync().arg("--locked").arg("--dry-run"), @r"
|
||||||
success: false
|
success: false
|
||||||
exit_code: 2
|
exit_code: 1
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
|
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
|
|
@ -8635,7 +8635,7 @@ fn sync_dry_run_and_locked() -> Result<()> {
|
||||||
Would download 1 package
|
Would download 1 package
|
||||||
Would install 1 package
|
Would install 1 package
|
||||||
+ iniconfig==2.0.0
|
+ iniconfig==2.0.0
|
||||||
error: The lockfile at `uv.lock` needs to be updated, but `--locked` was provided. To update the lockfile, run `uv lock`.
|
The lockfile at `uv.lock` needs to be updated, but `--locked` was provided. To update the lockfile, run `uv lock`.
|
||||||
");
|
");
|
||||||
|
|
||||||
let updated = context.read("uv.lock");
|
let updated = context.read("uv.lock");
|
||||||
|
|
@ -8962,13 +8962,13 @@ fn sync_locked_script() -> Result<()> {
|
||||||
// Re-run with `--locked`.
|
// Re-run with `--locked`.
|
||||||
uv_snapshot!(&filters, context.sync().arg("--script").arg("script.py").arg("--locked"), @r"
|
uv_snapshot!(&filters, context.sync().arg("--script").arg("script.py").arg("--locked"), @r"
|
||||||
success: false
|
success: false
|
||||||
exit_code: 2
|
exit_code: 1
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
|
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
Using script environment at: [CACHE_DIR]/environments-v2/script-[HASH]
|
Using script environment at: [CACHE_DIR]/environments-v2/script-[HASH]
|
||||||
Resolved 4 packages in [TIME]
|
Resolved 4 packages in [TIME]
|
||||||
error: The lockfile at `uv.lock` needs to be updated, but `--locked` was provided. To update the lockfile, run `uv lock`.
|
The lockfile at `uv.lock` needs to be updated, but `--locked` was provided. To update the lockfile, run `uv lock`.
|
||||||
");
|
");
|
||||||
|
|
||||||
uv_snapshot!(&filters, context.sync().arg("--script").arg("script.py"), @r"
|
uv_snapshot!(&filters, context.sync().arg("--script").arg("script.py"), @r"
|
||||||
|
|
@ -9064,14 +9064,14 @@ fn sync_locked_script() -> Result<()> {
|
||||||
// Re-run with `--locked`.
|
// Re-run with `--locked`.
|
||||||
uv_snapshot!(&filters, context.sync().arg("--script").arg("script.py").arg("--locked"), @r"
|
uv_snapshot!(&filters, context.sync().arg("--script").arg("script.py").arg("--locked"), @r"
|
||||||
success: false
|
success: false
|
||||||
exit_code: 2
|
exit_code: 1
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
|
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
Updating script environment at: [CACHE_DIR]/environments-v2/script-[HASH]
|
Updating script environment at: [CACHE_DIR]/environments-v2/script-[HASH]
|
||||||
warning: Ignoring existing lockfile due to fork markers being disjoint with `requires-python`: `python_full_version >= '3.11'` vs `python_full_version >= '3.8' and python_full_version < '3.11'`
|
warning: Ignoring existing lockfile due to fork markers being disjoint with `requires-python`: `python_full_version >= '3.11'` vs `python_full_version >= '3.8' and python_full_version < '3.11'`
|
||||||
Resolved 6 packages in [TIME]
|
Resolved 6 packages in [TIME]
|
||||||
error: The lockfile at `uv.lock` needs to be updated, but `--locked` was provided. To update the lockfile, run `uv lock`.
|
The lockfile at `uv.lock` needs to be updated, but `--locked` was provided. To update the lockfile, run `uv lock`.
|
||||||
");
|
");
|
||||||
|
|
||||||
uv_snapshot!(&filters, context.sync().arg("--script").arg("script.py"), @r"
|
uv_snapshot!(&filters, context.sync().arg("--script").arg("script.py"), @r"
|
||||||
|
|
@ -9944,12 +9944,12 @@ fn sync_build_constraints() -> Result<()> {
|
||||||
// This should fail, given that the build constraints have changed.
|
// This should fail, given that the build constraints have changed.
|
||||||
uv_snapshot!(context.filters(), context.sync().arg("--locked"), @r"
|
uv_snapshot!(context.filters(), context.sync().arg("--locked"), @r"
|
||||||
success: false
|
success: false
|
||||||
exit_code: 2
|
exit_code: 1
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
|
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
Resolved 2 packages in [TIME]
|
Resolved 2 packages in [TIME]
|
||||||
error: The lockfile at `uv.lock` needs to be updated, but `--locked` was provided. To update the lockfile, run `uv lock`.
|
The lockfile at `uv.lock` needs to be updated, but `--locked` was provided. To update the lockfile, run `uv lock`.
|
||||||
");
|
");
|
||||||
|
|
||||||
// Changing the build constraints should lead to a re-resolve.
|
// Changing the build constraints should lead to a re-resolve.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue