//! DO NOT EDIT
//!
//! Generated with `{{generated_with}}`
//! Scenarios from <{{generated_from}}>
//!
#![cfg(all(feature = "test-python", feature = "test-pypi", unix))]

use std::process::Command;

use uv_static::EnvVars;

use uv_test::{TestContext, build_vendor_links_url, packse_index_url, uv_snapshot};

/// Create a `pip install` command with options shared across all scenarios.
fn command(context: &TestContext) -> Command {
    let mut command = context.pip_install();
    command
        .arg("--index-url")
        .arg(packse_index_url())
        .arg("--find-links")
        .arg(build_vendor_links_url());
    command.env_remove(EnvVars::UV_EXCLUDE_NEWER);
    command
}

{{#scenarios}}

/// {{description}}
///
/// ```text
/// {{name}}
{{#tree}}
/// {{.}}
{{/tree}}
/// ```
{{#python_patch}}
#[cfg(feature = "test-python-patch")]
{{/python_patch}}
#[test]
fn {{module_name}}() {
    let context = uv_test::test_context!("{{environment.python}}");

    // In addition to the standard filters, swap out package names for shorter messages
    let mut filters = context.filters();
    filters.push((r"{{name}}-", "package-"));

    uv_snapshot!(filters, command(&context)
        {{#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_platform}}
        .arg("--python-platform={{.}}")
        {{/resolver_options.python_platform}}
        {{#root.requires}}
        .arg("{{requirement}}")
        {{/root.requires}}, @r#"<snapshot>
    "#);

    {{#expected.explanation}}
    // {{expected.explanation}}
    {{/expected.explanation}}
    {{#expected.satisfiable}}
    {{#expected.packages}}
    context.assert_installed("{{module_name}}", "{{version}}");
    {{/expected.packages}}
    {{/expected.satisfiable}}
    {{^expected.satisfiable}}
    {{#root.requires}}
    context.assert_not_installed("{{module_name}}");
    {{/root.requires}}
    {{/expected.satisfiable}}
}
{{/scenarios}}
