Simplify the packse scenario package name filters (#2440)

I liked the bird names but we can't actually apply those in some
situations (i.e. when the package is not supposed to exist) — this is
simpler.
This commit is contained in:
Zanie Blue 2024-03-13 20:16:51 -05:00 committed by GitHub
parent 104c74d911
commit 044a77cfd2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 375 additions and 607 deletions

View File

@ -68,8 +68,7 @@ fn incompatible_python_compatible_override() -> Result<()> {
// In addition to the standard filters, swap out package names for more realistic messages // In addition to the standard filters, swap out package names for more realistic messages
let mut filters = INSTA_FILTERS.to_vec(); let mut filters = INSTA_FILTERS.to_vec();
filters.push((r"incompatible-python-compatible-override-a", "albatross")); filters.push((r"incompatible-python-compatible-override-", "package-"));
filters.push((r"incompatible-python-compatible-override-", "pkg-"));
let requirements_in = context.temp_dir.child("requirements.in"); let requirements_in = context.temp_dir.child("requirements.in");
requirements_in.write_str("incompatible-python-compatible-override-a==1.0.0")?; requirements_in.write_str("incompatible-python-compatible-override-a==1.0.0")?;
@ -82,7 +81,7 @@ fn incompatible_python_compatible_override() -> Result<()> {
----- stdout ----- ----- stdout -----
# This file was autogenerated by uv via the following command: # This file was autogenerated by uv via the following command:
# uv pip compile requirements.in --cache-dir [CACHE_DIR] --python-version=3.11 # uv pip compile requirements.in --cache-dir [CACHE_DIR] --python-version=3.11
albatross==1.0.0 package-a==1.0.0
----- stderr ----- ----- stderr -----
warning: The requested Python version 3.11 is not available; 3.9.18 will be used to build dependencies instead. warning: The requested Python version 3.11 is not available; 3.9.18 will be used to build dependencies instead.
@ -118,8 +117,7 @@ fn compatible_python_incompatible_override() -> Result<()> {
// In addition to the standard filters, swap out package names for more realistic messages // In addition to the standard filters, swap out package names for more realistic messages
let mut filters = INSTA_FILTERS.to_vec(); let mut filters = INSTA_FILTERS.to_vec();
filters.push((r"compatible-python-incompatible-override-a", "albatross")); filters.push((r"compatible-python-incompatible-override-", "package-"));
filters.push((r"compatible-python-incompatible-override-", "pkg-"));
let requirements_in = context.temp_dir.child("requirements.in"); let requirements_in = context.temp_dir.child("requirements.in");
requirements_in.write_str("compatible-python-incompatible-override-a==1.0.0")?; requirements_in.write_str("compatible-python-incompatible-override-a==1.0.0")?;
@ -134,8 +132,8 @@ fn compatible_python_incompatible_override() -> Result<()> {
----- stderr ----- ----- stderr -----
warning: The requested Python version 3.9 is not available; 3.11.7 will be used to build dependencies instead. warning: The requested Python version 3.9 is not available; 3.11.7 will be used to build dependencies instead.
× No solution found when resolving dependencies: × No solution found when resolving dependencies:
Because the requested Python version (3.9) does not satisfy Python>=3.10 and albatross==1.0.0 depends on Python>=3.10, we can conclude that albatross==1.0.0 cannot be used. Because the requested Python version (3.9) does not satisfy Python>=3.10 and package-a==1.0.0 depends on Python>=3.10, we can conclude that package-a==1.0.0 cannot be used.
And because you require albatross==1.0.0, we can conclude that the requirements are unsatisfiable. And because you require package-a==1.0.0, we can conclude that the requirements are unsatisfiable.
"### "###
); );
@ -166,13 +164,9 @@ fn incompatible_python_compatible_override_unavailable_no_wheels() -> Result<()>
// In addition to the standard filters, swap out package names for more realistic messages // In addition to the standard filters, swap out package names for more realistic messages
let mut filters = INSTA_FILTERS.to_vec(); let mut filters = INSTA_FILTERS.to_vec();
filters.push((
r"incompatible-python-compatible-override-unavailable-no-wheels-a",
"albatross",
));
filters.push(( filters.push((
r"incompatible-python-compatible-override-unavailable-no-wheels-", r"incompatible-python-compatible-override-unavailable-no-wheels-",
"pkg-", "package-",
)); ));
let requirements_in = context.temp_dir.child("requirements.in"); let requirements_in = context.temp_dir.child("requirements.in");
@ -192,8 +186,8 @@ fn incompatible_python_compatible_override_unavailable_no_wheels() -> Result<()>
----- stderr ----- ----- stderr -----
warning: The requested Python version 3.11 is not available; 3.9.18 will be used to build dependencies instead. warning: The requested Python version 3.11 is not available; 3.9.18 will be used to build dependencies instead.
× No solution found when resolving dependencies: × No solution found when resolving dependencies:
Because the current Python version (3.9.18) does not satisfy Python>=3.10 and albatross==1.0.0 depends on Python>=3.10, we can conclude that albatross==1.0.0 cannot be used. Because the current Python version (3.9.18) does not satisfy Python>=3.10 and package-a==1.0.0 depends on Python>=3.10, we can conclude that package-a==1.0.0 cannot be used.
And because you require albatross==1.0.0, we can conclude that the requirements are unsatisfiable. And because you require package-a==1.0.0, we can conclude that the requirements are unsatisfiable.
"### "###
); );
@ -226,13 +220,9 @@ fn incompatible_python_compatible_override_available_no_wheels() -> Result<()> {
// In addition to the standard filters, swap out package names for more realistic messages // In addition to the standard filters, swap out package names for more realistic messages
let mut filters = INSTA_FILTERS.to_vec(); let mut filters = INSTA_FILTERS.to_vec();
filters.push((
r"incompatible-python-compatible-override-available-no-wheels-a",
"albatross",
));
filters.push(( filters.push((
r"incompatible-python-compatible-override-available-no-wheels-", r"incompatible-python-compatible-override-available-no-wheels-",
"pkg-", "package-",
)); ));
let requirements_in = context.temp_dir.child("requirements.in"); let requirements_in = context.temp_dir.child("requirements.in");
@ -249,7 +239,7 @@ fn incompatible_python_compatible_override_available_no_wheels() -> Result<()> {
----- stdout ----- ----- stdout -----
# This file was autogenerated by uv via the following command: # This file was autogenerated by uv via the following command:
# uv pip compile requirements.in --cache-dir [CACHE_DIR] --python-version=3.11 # uv pip compile requirements.in --cache-dir [CACHE_DIR] --python-version=3.11
albatross==1.0.0 package-a==1.0.0
----- stderr ----- ----- stderr -----
Resolved 1 package in [TIME] Resolved 1 package in [TIME]
@ -285,13 +275,9 @@ fn incompatible_python_compatible_override_no_compatible_wheels() -> Result<()>
// In addition to the standard filters, swap out package names for more realistic messages // In addition to the standard filters, swap out package names for more realistic messages
let mut filters = INSTA_FILTERS.to_vec(); let mut filters = INSTA_FILTERS.to_vec();
filters.push((
r"incompatible-python-compatible-override-no-compatible-wheels-a",
"albatross",
));
filters.push(( filters.push((
r"incompatible-python-compatible-override-no-compatible-wheels-", r"incompatible-python-compatible-override-no-compatible-wheels-",
"pkg-", "package-",
)); ));
let requirements_in = context.temp_dir.child("requirements.in"); let requirements_in = context.temp_dir.child("requirements.in");
@ -311,8 +297,8 @@ fn incompatible_python_compatible_override_no_compatible_wheels() -> Result<()>
----- stderr ----- ----- stderr -----
warning: The requested Python version 3.11 is not available; 3.9.18 will be used to build dependencies instead. warning: The requested Python version 3.11 is not available; 3.9.18 will be used to build dependencies instead.
× No solution found when resolving dependencies: × No solution found when resolving dependencies:
Because the current Python version (3.9.18) does not satisfy Python>=3.10 and albatross==1.0.0 depends on Python>=3.10, we can conclude that albatross==1.0.0 cannot be used. Because the current Python version (3.9.18) does not satisfy Python>=3.10 and package-a==1.0.0 depends on Python>=3.10, we can conclude that package-a==1.0.0 cannot be used.
And because you require albatross==1.0.0, we can conclude that the requirements are unsatisfiable. And because you require package-a==1.0.0, we can conclude that the requirements are unsatisfiable.
"### "###
); );
@ -347,13 +333,9 @@ fn incompatible_python_compatible_override_other_wheel() -> Result<()> {
// In addition to the standard filters, swap out package names for more realistic messages // In addition to the standard filters, swap out package names for more realistic messages
let mut filters = INSTA_FILTERS.to_vec(); let mut filters = INSTA_FILTERS.to_vec();
filters.push((
r"incompatible-python-compatible-override-other-wheel-a",
"albatross",
));
filters.push(( filters.push((
r"incompatible-python-compatible-override-other-wheel-", r"incompatible-python-compatible-override-other-wheel-",
"pkg-", "package-",
)); ));
let requirements_in = context.temp_dir.child("requirements.in"); let requirements_in = context.temp_dir.child("requirements.in");
@ -373,15 +355,15 @@ fn incompatible_python_compatible_override_other_wheel() -> Result<()> {
----- stderr ----- ----- stderr -----
warning: The requested Python version 3.11 is not available; 3.9.18 will be used to build dependencies instead. warning: The requested Python version 3.11 is not available; 3.9.18 will be used to build dependencies instead.
× No solution found when resolving dependencies: × No solution found when resolving dependencies:
Because the current Python version (3.9.18) does not satisfy Python>=3.10 and albatross==1.0.0 depends on Python>=3.10, we can conclude that albatross==1.0.0 cannot be used. Because the current Python version (3.9.18) does not satisfy Python>=3.10 and package-a==1.0.0 depends on Python>=3.10, we can conclude that package-a==1.0.0 cannot be used.
And because only the following versions of albatross are available: And because only the following versions of package-a are available:
albatross==1.0.0 package-a==1.0.0
albatross==2.0.0 package-a==2.0.0
we can conclude that albatross<2.0.0 cannot be used. (1) we can conclude that package-a<2.0.0 cannot be used. (1)
Because the requested Python version (3.11) does not satisfy Python>=3.12 and albatross==2.0.0 depends on Python>=3.12, we can conclude that albatross==2.0.0 cannot be used. Because the requested Python version (3.11) does not satisfy Python>=3.12 and package-a==2.0.0 depends on Python>=3.12, we can conclude that package-a==2.0.0 cannot be used.
And because we know from (1) that albatross<2.0.0 cannot be used, we can conclude that all versions of albatross cannot be used. And because we know from (1) that package-a<2.0.0 cannot be used, we can conclude that all versions of package-a cannot be used.
And because you require albatross, we can conclude that the requirements are unsatisfiable. And because you require package-a, we can conclude that the requirements are unsatisfiable.
"### "###
); );
@ -411,8 +393,7 @@ fn python_patch_override_no_patch() -> Result<()> {
// In addition to the standard filters, swap out package names for more realistic messages // In addition to the standard filters, swap out package names for more realistic messages
let mut filters = INSTA_FILTERS.to_vec(); let mut filters = INSTA_FILTERS.to_vec();
filters.push((r"python-patch-override-no-patch-a", "albatross")); filters.push((r"python-patch-override-no-patch-", "package-"));
filters.push((r"python-patch-override-no-patch-", "pkg-"));
let requirements_in = context.temp_dir.child("requirements.in"); let requirements_in = context.temp_dir.child("requirements.in");
requirements_in.write_str("python-patch-override-no-patch-a==1.0.0")?; requirements_in.write_str("python-patch-override-no-patch-a==1.0.0")?;
@ -428,8 +409,8 @@ fn python_patch_override_no_patch() -> Result<()> {
----- stderr ----- ----- stderr -----
× No solution found when resolving dependencies: × No solution found when resolving dependencies:
Because the requested Python version (3.8) does not satisfy Python>=3.8.4 and albatross==1.0.0 depends on Python>=3.8.4, we can conclude that albatross==1.0.0 cannot be used. Because the requested Python version (3.8) does not satisfy Python>=3.8.4 and package-a==1.0.0 depends on Python>=3.8.4, we can conclude that package-a==1.0.0 cannot be used.
And because you require albatross==1.0.0, we can conclude that the requirements are unsatisfiable. And because you require package-a==1.0.0, we can conclude that the requirements are unsatisfiable.
"### "###
); );
@ -459,8 +440,7 @@ fn python_patch_override_patch_compatible() -> Result<()> {
// In addition to the standard filters, swap out package names for more realistic messages // In addition to the standard filters, swap out package names for more realistic messages
let mut filters = INSTA_FILTERS.to_vec(); let mut filters = INSTA_FILTERS.to_vec();
filters.push((r"python-patch-override-patch-compatible-a", "albatross")); filters.push((r"python-patch-override-patch-compatible-", "package-"));
filters.push((r"python-patch-override-patch-compatible-", "pkg-"));
let requirements_in = context.temp_dir.child("requirements.in"); let requirements_in = context.temp_dir.child("requirements.in");
requirements_in.write_str("python-patch-override-patch-compatible-a==1.0.0")?; requirements_in.write_str("python-patch-override-patch-compatible-a==1.0.0")?;
@ -473,7 +453,7 @@ fn python_patch_override_patch_compatible() -> Result<()> {
----- stdout ----- ----- stdout -----
# This file was autogenerated by uv via the following command: # This file was autogenerated by uv via the following command:
# uv pip compile requirements.in --cache-dir [CACHE_DIR] --python-version=3.8.0 # uv pip compile requirements.in --cache-dir [CACHE_DIR] --python-version=3.8.0
albatross==1.0.0 package-a==1.0.0
----- stderr ----- ----- stderr -----
warning: The requested Python version 3.8.0 is not available; 3.8.18 will be used to build dependencies instead. warning: The requested Python version 3.8.0 is not available; 3.8.18 will be used to build dependencies instead.

File diff suppressed because it is too large Load Diff

View File

@ -55,17 +55,6 @@ TESTS = PROJECT_ROOT / "crates" / "uv" / "tests"
INSTALL_TESTS = TESTS / "pip_install_scenarios.rs" INSTALL_TESTS = TESTS / "pip_install_scenarios.rs"
COMPILE_TESTS = TESTS / "pip_compile_scenarios.rs" COMPILE_TESTS = TESTS / "pip_compile_scenarios.rs"
CUTE_NAMES = {
"a": "albatross",
"b": "bluebird",
"c": "crow",
"d": "duck",
"e": "eagle",
"f": "flamingo",
"g": "goose",
"h": "heron",
}
try: try:
import packse import packse
import packse.inspect import packse.inspect
@ -157,11 +146,6 @@ def main(scenarios: list[Path], snapshot_update: bool = True):
"explanation" "explanation"
] = "We do not have correct behavior for local version identifiers yet" ] = "We do not have correct behavior for local version identifiers yet"
# Generate cute names for each scenario
for scenario in data["scenarios"]:
for package in scenario["packages"]:
package["cute_name"] = CUTE_NAMES[package["name"].rsplit("-")[-1]]
# Split scenarios into `install` and `compile` cases # Split scenarios into `install` and `compile` cases
install_scenarios = [] install_scenarios = []
compile_scenarios = [] compile_scenarios = []

View File

@ -63,12 +63,9 @@ fn {{module_name}}() -> Result<()> {
let context = TestContext::new("{{environment.python}}"); let context = TestContext::new("{{environment.python}}");
let python_versions = &[{{#environment.additional_python}}"{{.}}", {{/environment.additional_python}}]; let python_versions = &[{{#environment.additional_python}}"{{.}}", {{/environment.additional_python}}];
// In addition to the standard filters, swap out package names for more realistic messages // In addition to the standard filters, swap out package names for shorter messages
let mut filters = INSTA_FILTERS.to_vec(); let mut filters = INSTA_FILTERS.to_vec();
{{#packages}} filters.push((r"{{name}}-", "package-"));
filters.push((r"{{name}}", "{{cute_name}}"));
{{/packages}}
filters.push((r"{{name}}-", "pkg-"));
let requirements_in = context.temp_dir.child("requirements.in"); let requirements_in = context.temp_dir.child("requirements.in");
{{#root.requires}} {{#root.requires}}

View File

@ -81,12 +81,9 @@ fn command(context: &TestContext) -> Command {
fn {{module_name}}() { fn {{module_name}}() {
let context = TestContext::new("{{environment.python}}"); let context = TestContext::new("{{environment.python}}");
// In addition to the standard filters, swap out package names for more realistic messages // In addition to the standard filters, swap out package names for shorter messages
let mut filters = INSTA_FILTERS.to_vec(); let mut filters = INSTA_FILTERS.to_vec();
{{#packages}} filters.push((r"{{name}}-", "package-"));
filters.push((r"{{name}}", "{{cute_name}}"));
{{/packages}}
filters.push((r"{{name}}-", "pkg-"));
uv_snapshot!(filters, command(&context) uv_snapshot!(filters, command(&context)
{{#resolver_options.prereleases}} {{#resolver_options.prereleases}}