Remove redundant tests#19766
Draft
konstin wants to merge 2 commits into
Draft
Conversation
uv test inventory changesThis PR changes the tests when compared with the latest
|
Member
|
I'm not sure of the value of, e.g., replacing |
Member
|
(some of these look good though) |
EliteTK
reviewed
Jun 10, 2026
Comment on lines
-3547
to
-3586
| /// Raise an error when a direct URL dependency's `Requires-Python` constraint is not met. | ||
| #[test] | ||
| fn requires_python_direct_url() -> Result<()> { | ||
| let context = uv_test::test_context!("3.12"); | ||
|
|
||
| // Create an editable package with a `Requires-Python` constraint that is not met. | ||
| let editable_dir = context.temp_dir.child("editable"); | ||
| editable_dir.create_dir_all()?; | ||
| let pyproject_toml = editable_dir.child("pyproject.toml"); | ||
| pyproject_toml.write_str( | ||
| r#"[project] | ||
| name = "example" | ||
| version = "0.0.0" | ||
| dependencies = [ | ||
| "anyio==4.0.0" | ||
| ] | ||
| requires-python = ">=3.13" | ||
| "#, | ||
| )?; | ||
|
|
||
| // Write to a requirements file. | ||
| let requirements_in = context.temp_dir.child("requirements.in"); | ||
| requirements_in.write_str(&format!("example @ {}", editable_dir.path().display()))?; | ||
|
|
||
| uv_snapshot!(context.filters(), context.pip_sync() | ||
| .arg("requirements.in"), @" | ||
| success: false | ||
| exit_code: 1 | ||
| ----- stdout ----- | ||
|
|
||
| ----- stderr ----- | ||
| × No solution found when resolving dependencies: | ||
| ╰─▶ Because the current Python version (3.12.[X]) does not satisfy Python>=3.13 and example==0.0.0 depends on Python>=3.13, we can conclude that example==0.0.0 cannot be used. | ||
| And because only example==0.0.0 is available and you require example, we can conclude that your requirements are unsatisfiable. | ||
| " | ||
| ); | ||
|
|
||
| Ok(()) | ||
| } | ||
|
|
Member
There was a problem hiding this comment.
Deleting this and the above removes all pip sync integration coverage asserting the correct forwarding and rejection of Requires-Python package metadata.
Member
There was a problem hiding this comment.
But aside from this, I can't see any issues with removing the rest.
I had codex search for redundant tests, and this is what it found: | Removed test | Retained coverage | Why it was redundant | | --- | --- | --- | | `python_module::find_uv_bin_py312` | `python_module::find_uv_bin_venv` | The tests had the same Python version, context filters, fake `uv` installation, lookup script, and snapshots. Only the duplicate test name differed. | | `pip_compile::conflicting_url_markers` | `pip_compile::compile_constraints_incompatible_version` and `pip_compile::conflicting_repeated_url_dependency_markers` | Its body and snapshot were identical to `compile_constraints_incompatible_version`; despite its name, it did not contain a URL or marker. The separate URL-marker test retains actual URL-marker coverage. | | `tool_upgrade::tool_upgrade_with` | `tool_upgrade::tool_upgrade_pinned_hint` | Both installed pinned `babel==2.6.0`, upgraded only its `pytz` dependency, and asserted the same pinned-tool hint. The retained test has the clearer behavioral name. | | `venv::create_venv_symlink_recreate_preservation` | `venv::create_venv_symlink_clear_preservation` | Both created a symlinked virtual environment and then recreated it with `--clear`, asserting that the symlink survived both operations. | | `pip_install::invalid_group` | `pip_compile::invalid_group`, plus the valid `pip install --group` integration tests | The invalid-value cases and snapshots were copied from the compile test and exercise the shared `PipGroupName` parser and requirements-source validation. Install-specific group execution remains covered by nearby install tests. | | `pip_sync::requires_python_editable` | `pip_compile::requires_python_editable` and `pip_install::requires_python_editable` | The sync test repeated the same incompatible editable metadata and resolver diagnostic. Compile and install retain the resolver failure coverage, while other sync tests retain sync-specific editable behavior. | | `pip_sync::requires_python_direct_url` | `pip_compile::requires_python_direct_url` and `pip_install::requires_python_direct_url` | The sync test repeated the same incompatible direct-URL metadata and resolver diagnostic. Compile and install retain the resolver failure coverage, while other sync tests retain sync-specific direct-URL behavior. | | Generated `pip_install_scenarios::package_prereleases_global_boundary` and `package-prereleases-global-boundary.toml` | `package-prereleases-boundary.toml` and its generated test | The two scenario TOMLs were identical except for the scenario name; they produced the same package selection and explanation. | | `expanded_tags::test_parse_expanded_tag_single_segment` | `expanded_tags::test_parse_simple_expanded_tag` | Both parsed `py3-none-any` and snapshot the same expanded tag. The retained test enters through the public `ExpandedTags::parse` API. | | `expanded_tags::test_parse_expanded_tag_empty` | `expanded_tags::test_error_missing_language_tag` | Both pass an empty tag and assert `MissingLanguageTag`. The retained test covers the error through the public API. | | `expanded_tags::test_parse_expanded_tag_one_segment` | `expanded_tags::test_error_missing_abi_tag` | Both exercise the one-segment missing-ABI branch and assert `MissingAbiTag`. The retained test covers it through the public API. | | `expanded_tags::test_parse_expanded_tag_two_segments` | `expanded_tags::test_error_missing_platform_tag` | Both pass `py3-none` and assert `MissingPlatformTag`. The retained test covers the error through the public API. | | `expanded_tags::test_parse_expanded_tag_four_segments` | `expanded_tags::test_error_extra_segment` | Both pass `py3-none-any-extra` and assert `ExtraSegment`. The retained test covers the error through the public API. | | `wheel::test_wheel` | `wheel::test_prepare_metadata` | Both asserted the same generated `WHEEL` contents. The retained test reaches them through metadata preparation and `dist-info` writing, so it covers the formatter in a representative workflow. | | `requirements_txt::line_endings(empty.txt)` | `requirements_txt::parse(empty.txt)` | `empty.txt` is zero bytes, so line-ending normalization is a no-op and the two snapshots were identical. | | `requirements_txt::line_endings(include-b.txt)` | `requirements_txt::parse(include-b.txt)` | `include-b.txt` contains `tomli` with no line ending, so conversion is also a no-op and the two snapshots were identical. Other non-empty cases remain to exercise actual LF-to-CRLF and CRLF-to-LF conversion. |
I had codex search for redundant tests, and this is what it found: | Removed test | Retained coverage | Why it was redundant | | --- | --- | --- | | `python_module::find_uv_bin_py312` | `python_module::find_uv_bin_venv` | The tests had the same Python version, context filters, fake `uv` installation, lookup script, and snapshots. Only the duplicate test name differed. | | `pip_compile::conflicting_url_markers` | `pip_compile::compile_constraints_incompatible_version` and `pip_compile::conflicting_repeated_url_dependency_markers` | Its body and snapshot were identical to `compile_constraints_incompatible_version`; despite its name, it did not contain a URL or marker. The separate URL-marker test retains actual URL-marker coverage. | | `tool_upgrade::tool_upgrade_with` | `tool_upgrade::tool_upgrade_pinned_hint` | Both installed pinned `babel==2.6.0`, upgraded only its `pytz` dependency, and asserted the same pinned-tool hint. The retained test has the clearer behavioral name. | | `venv::create_venv_symlink_recreate_preservation` | `venv::create_venv_symlink_clear_preservation` | Both created a symlinked virtual environment and then recreated it with `--clear`, asserting that the symlink survived both operations. | | `pip_install::invalid_group` | `pip_compile::invalid_group`, plus the valid `pip install --group` integration tests | The invalid-value cases and snapshots were copied from the compile test and exercise the shared `PipGroupName` parser and requirements-source validation. Install-specific group execution remains covered by nearby install tests. | | `pip_sync::requires_python_editable` | `pip_compile::requires_python_editable` and `pip_install::requires_python_editable` | The sync test repeated the same incompatible editable metadata and resolver diagnostic. Compile and install retain the resolver failure coverage, while other sync tests retain sync-specific editable behavior. | | `pip_sync::requires_python_direct_url` | `pip_compile::requires_python_direct_url` and `pip_install::requires_python_direct_url` | The sync test repeated the same incompatible direct-URL metadata and resolver diagnostic. Compile and install retain the resolver failure coverage, while other sync tests retain sync-specific direct-URL behavior. | | Generated `pip_install_scenarios::package_prereleases_global_boundary` and `package-prereleases-global-boundary.toml` | `package-prereleases-boundary.toml` and its generated test | The two scenario TOMLs were identical except for the scenario name; they produced the same package selection and explanation. | | `expanded_tags::test_parse_expanded_tag_single_segment` | `expanded_tags::test_parse_simple_expanded_tag` | Both parsed `py3-none-any` and snapshot the same expanded tag. The retained test enters through the public `ExpandedTags::parse` API. | | `expanded_tags::test_parse_expanded_tag_empty` | `expanded_tags::test_error_missing_language_tag` | Both pass an empty tag and assert `MissingLanguageTag`. The retained test covers the error through the public API. | | `expanded_tags::test_parse_expanded_tag_one_segment` | `expanded_tags::test_error_missing_abi_tag` | Both exercise the one-segment missing-ABI branch and assert `MissingAbiTag`. The retained test covers it through the public API. | | `expanded_tags::test_parse_expanded_tag_two_segments` | `expanded_tags::test_error_missing_platform_tag` | Both pass `py3-none` and assert `MissingPlatformTag`. The retained test covers the error through the public API. | | `expanded_tags::test_parse_expanded_tag_four_segments` | `expanded_tags::test_error_extra_segment` | Both pass `py3-none-any-extra` and assert `ExtraSegment`. The retained test covers the error through the public API. | | `requirements_txt::line_endings(empty.txt)` | `requirements_txt::parse(empty.txt)` | `empty.txt` is zero bytes, so line-ending normalization is a no-op and the two snapshots were identical. | | `requirements_txt::line_endings(include-b.txt)` | `requirements_txt::parse(include-b.txt)` | `include-b.txt` contains `tomli` with no line ending, so conversion is also a no-op and the two snapshots were identical. Other non-empty cases remain to exercise actual LF-to-CRLF and CRLF-to-LF conversion. |
a1c27db to
727cd4b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I had codex search for redundant tests, and the results seem kinda useful. Not a big jump in test performance, but a cheap cleanup.
python_module::find_uv_bin_py312python_module::find_uv_bin_venvuvinstallation, lookup script, and snapshots. Only the duplicate test name differed.pip_compile::conflicting_url_markerspip_compile::compile_constraints_incompatible_versionandpip_compile::conflicting_repeated_url_dependency_markerscompile_constraints_incompatible_version; despite its name, it did not contain a URL or marker. The separate URL-marker test retains actual URL-marker coverage.tool_upgrade::tool_upgrade_withtool_upgrade::tool_upgrade_pinned_hintbabel==2.6.0, upgraded only itspytzdependency, and asserted the same pinned-tool hint. The retained test has the clearer behavioral name.venv::create_venv_symlink_recreate_preservationvenv::create_venv_symlink_clear_preservation--clear, asserting that the symlink survived both operations.pip_install::invalid_grouppip_compile::invalid_group, plus the validpip install --groupintegration testsPipGroupNameparser and requirements-source validation. Install-specific group execution remains covered by nearby install tests.pip_sync::requires_python_editablepip_compile::requires_python_editableandpip_install::requires_python_editablepip_sync::requires_python_direct_urlpip_compile::requires_python_direct_urlandpip_install::requires_python_direct_urlpip_install_scenarios::package_prereleases_global_boundaryandpackage-prereleases-global-boundary.tomlpackage-prereleases-boundary.tomland its generated testexpanded_tags::test_parse_expanded_tag_single_segmentexpanded_tags::test_parse_simple_expanded_tagpy3-none-anyand snapshot the same expanded tag. The retained test enters through the publicExpandedTags::parseAPI.expanded_tags::test_parse_expanded_tag_emptyexpanded_tags::test_error_missing_language_tagMissingLanguageTag. The retained test covers the error through the public API.expanded_tags::test_parse_expanded_tag_one_segmentexpanded_tags::test_error_missing_abi_tagMissingAbiTag. The retained test covers it through the public API.expanded_tags::test_parse_expanded_tag_two_segmentsexpanded_tags::test_error_missing_platform_tagpy3-noneand assertMissingPlatformTag. The retained test covers the error through the public API.expanded_tags::test_parse_expanded_tag_four_segmentsexpanded_tags::test_error_extra_segmentpy3-none-any-extraand assertExtraSegment. The retained test covers the error through the public API.requirements_txt::line_endings(empty.txt)requirements_txt::parse(empty.txt)empty.txtis zero bytes, so line-ending normalization is a no-op and the two snapshots were identical.requirements_txt::line_endings(include-b.txt)requirements_txt::parse(include-b.txt)include-b.txtcontainstomliwith no line ending, so conversion is also a no-op and the two snapshots were identical. Other non-empty cases remain to exercise actual LF-to-CRLF and CRLF-to-LF conversion.