mirror of
https://github.com/astral-sh/uv.git
synced 2025-07-07 21:35:00 +00:00
Only textwrap json packse scenarios with packse 0.3.32 (#5810)
Companion change to https://github.com/astral-sh/packse/pull/205 to correctly format lock scenario doc comments. Updates packse to 0.3.32.
This commit is contained in:
parent
03797b0724
commit
ae6b59365f
11 changed files with 1104 additions and 189 deletions
|
@ -26,7 +26,7 @@ use uv_python::{
|
|||
// Exclude any packages uploaded after this date.
|
||||
static EXCLUDE_NEWER: &str = "2024-03-25T00:00:00Z";
|
||||
|
||||
pub const PACKSE_VERSION: &str = "0.3.31";
|
||||
pub const PACKSE_VERSION: &str = "0.3.32";
|
||||
|
||||
/// Using a find links url allows using `--index-url` instead of `--extra-index-url` in tests
|
||||
/// to prevent dependency confusion attacks against our test suite.
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,7 +1,7 @@
|
|||
//! DO NOT EDIT
|
||||
//!
|
||||
//! Generated with `./scripts/sync_scenarios.sh`
|
||||
//! Scenarios from <https://github.com/astral-sh/packse/tree/0.3.31/scenarios>
|
||||
//! Scenarios from <https://github.com/astral-sh/packse/tree/0.3.32/scenarios>
|
||||
//!
|
||||
#![cfg(all(feature = "python", feature = "pypi", unix))]
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//! DO NOT EDIT
|
||||
//!
|
||||
//! Generated with `./scripts/sync_scenarios.sh`
|
||||
//! Scenarios from <https://github.com/astral-sh/packse/tree/0.3.31/scenarios>
|
||||
//! Scenarios from <https://github.com/astral-sh/packse/tree/0.3.32/scenarios>
|
||||
//!
|
||||
#![cfg(all(feature = "python", feature = "pypi", unix))]
|
||||
|
||||
|
|
1
scripts/scenarios/.gitignore
vendored
Normal file
1
scripts/scenarios/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
.downloads
|
|
@ -124,18 +124,26 @@ def main(scenarios: list[Path], snapshot_update: bool = True):
|
|||
if not scenario["name"].startswith("example")
|
||||
]
|
||||
|
||||
# Wrap the description onto multiple lines
|
||||
# We have a mixture of long singe-line descriptions (json scenarios) we need to
|
||||
# wrap and manually formatted markdown in toml and yaml scenarios we want to
|
||||
# preserve.
|
||||
for scenario in data["scenarios"]:
|
||||
scenario["description_lines"] = textwrap.wrap(scenario["description"], width=80)
|
||||
if scenario["_textwrap"]:
|
||||
scenario["description"] = textwrap.wrap(scenario["description"], width=80)
|
||||
else:
|
||||
scenario["description"] = scenario["description"].splitlines()
|
||||
# Don't drop empty lines like chevron would.
|
||||
scenario["description"] = "\n/// ".join(scenario["description"])
|
||||
|
||||
# Wrap the expected explanation onto multiple lines
|
||||
# Apply the same wrapping to the expected explanation
|
||||
for scenario in data["scenarios"]:
|
||||
expected = scenario["expected"]
|
||||
expected["explanation_lines"] = (
|
||||
textwrap.wrap(expected["explanation"], width=80)
|
||||
if expected["explanation"]
|
||||
else []
|
||||
)
|
||||
if explanation := expected["explanation"]:
|
||||
if scenario["_textwrap"]:
|
||||
expected["explanation"] = textwrap.wrap(explanation, width=80)
|
||||
else:
|
||||
expected["explanation"] = explanation.splitlines()
|
||||
expected["explanation"] = "\n// ".join(expected["explanation"])
|
||||
|
||||
# Hack to track which scenarios require a specific Python patch version
|
||||
for scenario in data["scenarios"]:
|
||||
|
@ -155,9 +163,6 @@ def main(scenarios: list[Path], snapshot_update: bool = True):
|
|||
"local-used-without-sdist",
|
||||
):
|
||||
expected["satisfiable"] = False
|
||||
expected["explanation"] = (
|
||||
"We do not have correct behavior for local version identifiers yet"
|
||||
)
|
||||
|
||||
# Split scenarios into `install`, `compile` and `lock` cases
|
||||
install_scenarios = []
|
||||
|
@ -224,20 +229,21 @@ def main(scenarios: list[Path], snapshot_update: bool = True):
|
|||
if snapshot_update:
|
||||
logging.info("Updating snapshots...")
|
||||
env = os.environ.copy()
|
||||
env["UV_TEST_PYTHON_PATH"] = str(PROJECT_ROOT / "bin")
|
||||
command = [
|
||||
"cargo",
|
||||
"insta",
|
||||
"test",
|
||||
"--features",
|
||||
"pypi,python,python-patch",
|
||||
"--accept",
|
||||
"--test-runner",
|
||||
"nextest",
|
||||
"--test",
|
||||
tests.with_suffix("").name,
|
||||
]
|
||||
logging.debug(f"Running {" ".join(command)}")
|
||||
subprocess.call(
|
||||
[
|
||||
"cargo",
|
||||
"insta",
|
||||
"test",
|
||||
"--features",
|
||||
"pypi,python,python-patch",
|
||||
"--accept",
|
||||
"--test-runner",
|
||||
"nextest",
|
||||
"--test",
|
||||
tests.with_suffix("").name,
|
||||
],
|
||||
command,
|
||||
cwd=PROJECT_ROOT,
|
||||
stderr=subprocess.STDOUT,
|
||||
stdout=sys.stderr if debug else subprocess.DEVNULL,
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
chevron-blue
|
||||
packse>=0.3.31
|
||||
packse>=0.3.32
|
||||
|
|
|
@ -46,7 +46,7 @@ nh3==0.2.17
|
|||
# via readme-renderer
|
||||
packaging==24.0
|
||||
# via hatchling
|
||||
packse==0.3.31
|
||||
packse==0.3.32
|
||||
# via -r scripts/scenarios/requirements.in
|
||||
pathspec==0.12.1
|
||||
# via hatchling
|
||||
|
|
|
@ -39,9 +39,7 @@ fn command(context: &TestContext, python_versions: &[&str]) -> Command {
|
|||
|
||||
{{#scenarios}}
|
||||
|
||||
{{#description_lines}}
|
||||
/// {{.}}
|
||||
{{/description_lines}}
|
||||
/// {{description}}
|
||||
///
|
||||
/// ```text
|
||||
/// {{name}}
|
||||
|
@ -66,9 +64,9 @@ fn {{module_name}}() -> Result<()> {
|
|||
requirements_in.write_str("{{requirement}}")?;
|
||||
{{/root.requires}}
|
||||
|
||||
{{#expected.explanation_lines}}
|
||||
// {{.}}
|
||||
{{/expected.explanation_lines}}
|
||||
{{#expected.explanation}}
|
||||
// {{expected.explanation}}
|
||||
{{/expected.explanation}}
|
||||
let output = uv_snapshot!(filters, command(&context, python_versions)
|
||||
{{#resolver_options.prereleases}}
|
||||
.arg("--prerelease=allow")
|
||||
|
|
|
@ -57,9 +57,7 @@ fn command(context: &TestContext) -> Command {
|
|||
|
||||
{{#scenarios}}
|
||||
|
||||
{{#description_lines}}
|
||||
/// {{.}}
|
||||
{{/description_lines}}
|
||||
/// {{description}}
|
||||
///
|
||||
/// ```text
|
||||
/// {{name}}
|
||||
|
@ -95,9 +93,9 @@ fn {{module_name}}() {
|
|||
{{/root.requires}}, @r###"<snapshot>
|
||||
"###);
|
||||
|
||||
{{#expected.explanation_lines}}
|
||||
// {{.}}
|
||||
{{/expected.explanation_lines}}
|
||||
{{#expected.explanation}}
|
||||
// {{expected.explanation}}
|
||||
{{/expected.explanation}}
|
||||
{{#expected.satisfiable}}
|
||||
{{#expected.packages}}
|
||||
assert_installed(
|
||||
|
|
|
@ -17,9 +17,7 @@ mod common;
|
|||
|
||||
{{#scenarios}}
|
||||
|
||||
{{#description_lines}}
|
||||
/// {{.}}
|
||||
{{/description_lines}}
|
||||
/// {{description}}
|
||||
///
|
||||
/// ```text
|
||||
/// {{name}}
|
||||
|
@ -55,9 +53,9 @@ fn {{module_name}}() -> Result<()> {
|
|||
let mut cmd = context.lock();
|
||||
cmd.env_remove("UV_EXCLUDE_NEWER");
|
||||
cmd.arg("--index-url").arg(packse_index_url());
|
||||
{{#expected.explanation_lines}}
|
||||
// {{.}}
|
||||
{{/expected.explanation_lines}}
|
||||
{{#expected.explanation}}
|
||||
// {{expected.explanation}}
|
||||
{{/expected.explanation}}
|
||||
uv_snapshot!(filters, cmd, @r###"<snapshot>
|
||||
"###
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue