Update the scenarios to use vendored build dependencies (#1605)

Uses `--find-links` to discover vendored scenario build dependencies and
allows us to use `--index-url` instead of `--extra-index-url` to avoid
hitting the real PyPI in scenario tests.
This commit is contained in:
Zanie Blue 2024-02-19 15:55:03 -06:00 committed by GitHub
parent 1d9daa6de1
commit f3ef55f879
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 51 additions and 12 deletions

View file

@ -1,7 +1,7 @@
//! DO NOT EDIT
//!
//! Generated with ./scripts/scenarios/update.py
//! Scenarios from <https://github.com/zanieb/packse/tree/de58b3e3f998486b6c0f3dd67b7341c880eb54b2/scenarios>
//! Scenarios from <https://github.com/zanieb/packse/tree/de0bab473eeaa4445db5a8febd732c655fad3d52/scenarios>
//!
#![cfg(all(feature = "python", feature = "pypi"))]
@ -26,14 +26,23 @@ fn command(context: &TestContext, python_versions: &[&str]) -> Command {
.arg("pip")
.arg("compile")
.arg("requirements.in")
.arg("--extra-index-url")
.arg("--index-url")
.arg("https://test.pypi.org/simple")
.arg("--find-links")
.arg("https://raw.githubusercontent.com/zanieb/packse/de0bab473eeaa4445db5a8febd732c655fad3d52/vendor/links.html")
.arg("--cache-dir")
.arg(context.cache_dir.path())
.env("VIRTUAL_ENV", context.venv.as_os_str())
.env("UV_NO_WRAP", "1")
.env("UV_TEST_PYTHON_PATH", bin)
.current_dir(&context.temp_dir);
if cfg!(all(windows, debug_assertions)) {
// TODO(konstin): Reduce stack usage in debug mode enough that the tests pass with the
// default windows stack of 1MB
command.env("UV_STACK_SIZE", (8 * 1024 * 1024).to_string());
}
command
}
@ -74,7 +83,7 @@ fn requires_incompatible_python_version_compatible_override() -> Result<()> {
exit_code: 0
----- stdout -----
# This file was autogenerated by uv via the following command:
# uv pip compile requirements.in --extra-index-url https://test.pypi.org/simple --cache-dir [CACHE_DIR] --python-version=3.11
# uv pip compile requirements.in --index-url https://test.pypi.org/simple --find-links https://raw.githubusercontent.com/zanieb/packse/de0bab473eeaa4445db5a8febd732c655fad3d52/vendor/links.html --cache-dir [CACHE_DIR] --python-version=3.11
albatross==1.0.0
----- stderr -----
@ -235,7 +244,7 @@ fn requires_incompatible_python_version_compatible_override_no_wheels_available_
exit_code: 0
----- stdout -----
# This file was autogenerated by uv via the following command:
# uv pip compile requirements.in --extra-index-url https://test.pypi.org/simple --cache-dir [CACHE_DIR] --python-version=3.11
# uv pip compile requirements.in --index-url https://test.pypi.org/simple --find-links https://raw.githubusercontent.com/zanieb/packse/de0bab473eeaa4445db5a8febd732c655fad3d52/vendor/links.html --cache-dir [CACHE_DIR] --python-version=3.11
albatross==1.0.0
----- stderr -----
@ -455,7 +464,7 @@ fn requires_python_patch_version_override_patch_compatible() -> Result<()> {
exit_code: 0
----- stdout -----
# This file was autogenerated by uv via the following command:
# uv pip compile requirements.in --extra-index-url https://test.pypi.org/simple --cache-dir [CACHE_DIR] --python-version=3.8.0
# uv pip compile requirements.in --index-url https://test.pypi.org/simple --find-links https://raw.githubusercontent.com/zanieb/packse/de0bab473eeaa4445db5a8febd732c655fad3d52/vendor/links.html --cache-dir [CACHE_DIR] --python-version=3.8.0
albatross==1.0.0
----- stderr -----

View file

@ -1,7 +1,7 @@
//! DO NOT EDIT
//!
//! Generated with ./scripts/scenarios/update.py
//! Scenarios from <https://github.com/zanieb/packse/tree/64b4451b832cece378f6e773d326ea09efe8903d/scenarios>
//! Scenarios from <https://github.com/zanieb/packse/tree/de0bab473eeaa4445db5a8febd732c655fad3d52/scenarios>
//!
#![cfg(all(feature = "python", feature = "pypi"))]
@ -45,13 +45,22 @@ fn command(context: &TestContext) -> Command {
command
.arg("pip")
.arg("install")
.arg("--extra-index-url")
.arg("--index-url")
.arg("https://test.pypi.org/simple")
.arg("--find-links")
.arg("https://raw.githubusercontent.com/zanieb/packse/de0bab473eeaa4445db5a8febd732c655fad3d52/vendor/links.html")
.arg("--cache-dir")
.arg(context.cache_dir.path())
.env("VIRTUAL_ENV", context.venv.as_os_str())
.env("UV_NO_WRAP", "1")
.current_dir(&context.temp_dir);
if cfg!(all(windows, debug_assertions)) {
// TODO(konstin): Reduce stack usage in debug mode enough that the tests pass with the
// default windows stack of 1MB
command.env("UV_STACK_SIZE", (8 * 1024 * 1024).to_string());
}
command
}
@ -477,7 +486,7 @@ fn dependency_excludes_range_of_compatible_versions() {
/// There is a non-contiguous range of compatible versions for the requested package
/// `a`, but another dependency `c` excludes the range. This is the same as
/// `dependency-excludes-range-of-compatible-versions` but some of the versions of
/// `a` are incompatible for another reason e.g. dependency on non-existent package
/// `a` are incompatible for another reason e.g. dependency on non-existant package
/// `d`.
///
/// ```text
@ -737,7 +746,7 @@ fn multiple_extras_required() {
/// all-extras-required
///
/// Multiple optional dependencies are requested for the via an 'all' extra.
/// Multiple optional dependencies are requested for the package via an 'all' extra.
///
/// ```text
/// 4cf56e90

View file

@ -26,14 +26,23 @@ fn command(context: &TestContext, python_versions: &[&str]) -> Command {
.arg("pip")
.arg("compile")
.arg("requirements.in")
.arg("--extra-index-url")
.arg("--index-url")
.arg("https://test.pypi.org/simple")
.arg("--find-links")
.arg("{{vendor_links}}")
.arg("--cache-dir")
.arg(context.cache_dir.path())
.env("VIRTUAL_ENV", context.venv.as_os_str())
.env("UV_NO_WRAP", "1")
.env("UV_TEST_PYTHON_PATH", bin)
.current_dir(&context.temp_dir);
if cfg!(all(windows, debug_assertions)) {
// TODO(konstin): Reduce stack usage in debug mode enough that the tests pass with the
// default windows stack of 1MB
command.env("UV_STACK_SIZE", (8 * 1024 * 1024).to_string());
}
command
}

View file

@ -46,13 +46,22 @@ fn command(context: &TestContext) -> Command {
command
.arg("pip")
.arg("install")
.arg("--extra-index-url")
.arg("--index-url")
.arg("https://test.pypi.org/simple")
.arg("--find-links")
.arg("{{vendor_links}}")
.arg("--cache-dir")
.arg(context.cache_dir.path())
.env("VIRTUAL_ENV", context.venv.as_os_str())
.env("UV_NO_WRAP", "1")
.current_dir(&context.temp_dir);
if cfg!(all(windows, debug_assertions)) {
// TODO(konstin): Reduce stack usage in debug mode enough that the tests pass with the
// default windows stack of 1MB
command.env("UV_STACK_SIZE", (8 * 1024 * 1024).to_string());
}
command
}

View file

@ -45,7 +45,7 @@ import textwrap
from pathlib import Path
PACKSE_COMMIT = "64b4451b832cece378f6e773d326ea09efe8903d"
PACKSE_COMMIT = "de0bab473eeaa4445db5a8febd732c655fad3d52"
TOOL_ROOT = Path(__file__).parent
TEMPLATES = TOOL_ROOT / "templates"
INSTALL_TEMPLATE = TEMPLATES / "install.mustache"
@ -205,6 +205,9 @@ for template, tests, scenarios in [
# Add generated metadata
data["generated_from"] = f"https://github.com/zanieb/packse/tree/{commit}/scenarios"
data["generated_with"] = " ".join(sys.argv)
data[
"vendor_links"
] = f"https://raw.githubusercontent.com/zanieb/packse/{commit}/vendor/links.html"
# Render the template
print(f"Rendering template {template.name}", file=sys.stderr)