0f87d174b9
Every packse version update is currently causing a huge diff (the size of the `lock_scenarios.rs` diff in this PR). By redacting the version from the snapshots, we will only have the actual change in the diff and not the redundant version change noise. The second commit moves all remaining packse url arg values to `common/mod.rs`, which acts as a single source of truth for the packse version.
106 lines
3.0 KiB
Plaintext
106 lines
3.0 KiB
Plaintext
//! DO NOT EDIT
|
|
//!
|
|
//! Generated with `{{generated_with}}`
|
|
//! Scenarios from <{{generated_from}}>
|
|
//!
|
|
#![cfg(all(feature = "python", feature = "pypi", unix))]
|
|
|
|
use std::env;
|
|
use std::process::Command;
|
|
|
|
use anyhow::Result;
|
|
use assert_cmd::assert::OutputAssertExt;
|
|
use assert_fs::fixture::{FileWriteStr, PathChild};
|
|
use predicates::prelude::predicate;
|
|
|
|
use common::{build_vendor_links_url, packse_index_url, python_path_with_versions, get_bin, uv_snapshot, TestContext};
|
|
|
|
mod common;
|
|
|
|
/// Provision python binaries and return a `pip compile` command with options shared across all scenarios.
|
|
fn command(context: &TestContext, python_versions: &[&str]) -> Command {
|
|
let python_path = python_path_with_versions(&context.temp_dir, python_versions)
|
|
.expect("Failed to create Python test path");
|
|
let mut command = Command::new(get_bin());
|
|
command
|
|
.arg("pip")
|
|
.arg("compile")
|
|
.arg("requirements.in")
|
|
.arg("--index-url")
|
|
.arg(packse_index_url())
|
|
.arg("--find-links")
|
|
.arg(build_vendor_links_url());
|
|
context.add_shared_args(&mut command);
|
|
command.env_remove("UV_EXCLUDE_NEWER");
|
|
command.env("UV_TEST_PYTHON_PATH", python_path);
|
|
|
|
command
|
|
}
|
|
|
|
{{#scenarios}}
|
|
|
|
{{#description_lines}}
|
|
/// {{.}}
|
|
{{/description_lines}}
|
|
///
|
|
/// ```text
|
|
/// {{name}}
|
|
{{#tree}}
|
|
/// {{.}}
|
|
{{/tree}}
|
|
/// ```
|
|
{{#python_patch}}
|
|
#[cfg(feature = "python-patch")]
|
|
{{/python_patch}}
|
|
#[test]
|
|
fn {{module_name}}() -> Result<()> {
|
|
let context = TestContext::new("{{environment.python}}");
|
|
let python_versions = &[{{#environment.additional_python}}"{{.}}", {{/environment.additional_python}}];
|
|
|
|
// In addition to the standard filters, swap out package names for shorter messages
|
|
let mut filters = context.filters();
|
|
filters.push((r"{{name}}-", "package-"));
|
|
|
|
let requirements_in = context.temp_dir.child("requirements.in");
|
|
{{#root.requires}}
|
|
requirements_in.write_str("{{requirement}}")?;
|
|
{{/root.requires}}
|
|
|
|
{{#expected.explanation_lines}}
|
|
// {{.}}
|
|
{{/expected.explanation_lines}}
|
|
let output = uv_snapshot!(filters, command(&context, python_versions)
|
|
{{#resolver_options.prereleases}}
|
|
.arg("--prerelease=allow")
|
|
{{/resolver_options.prereleases}}
|
|
{{#resolver_options.no_build}}
|
|
.arg("--only-binary")
|
|
.arg("{{.}}")
|
|
{{/resolver_options.no_build}}
|
|
{{#resolver_options.no_binary}}
|
|
.arg("--no-binary")
|
|
.arg("{{.}}")
|
|
{{/resolver_options.no_binary}}
|
|
{{#resolver_options.python}}
|
|
.arg("--python-version={{.}}")
|
|
{{/resolver_options.python}}, @r###"<snapshot>
|
|
"###
|
|
);
|
|
|
|
output
|
|
.assert()
|
|
{{#expected.satisfiable}}
|
|
.success()
|
|
{{#expected.packages}}
|
|
.stdout(predicate::str::contains("{{name}}=={{version}}"))
|
|
{{/expected.packages}}
|
|
{{/expected.satisfiable}}
|
|
{{^expected.satisfiable}}
|
|
.failure()
|
|
{{/expected.satisfiable}}
|
|
;
|
|
|
|
Ok(())
|
|
}
|
|
{{/scenarios}}
|