Skip to content

Remove redundant tests#19766

Draft
konstin wants to merge 2 commits into
mainfrom
konsti/remove-redundant-tests
Draft

Remove redundant tests#19766
konstin wants to merge 2 commits into
mainfrom
konsti/remove-redundant-tests

Conversation

@konstin

@konstin konstin commented Jun 10, 2026

Copy link
Copy Markdown
Member

I had codex search for redundant tests, and the results seem kinda useful. Not a big jump in test performance, but a cheap cleanup.

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.

@konstin konstin added the internal A refactor or improvement that is not user-facing label Jun 10, 2026
@astral-sh-bot

astral-sh-bot Bot commented Jun 10, 2026

Copy link
Copy Markdown

uv test inventory changes

This PR changes the tests when compared with the latest main baseline.

  • Added tests: 0
  • Removed tests: 15
  • Changed suites: 7
uv-distribution-filename: +0 / -5

Added: none

Removed:

  • uv-distribution-filename::expanded_tags::tests::test_parse_expanded_tag_empty
  • uv-distribution-filename::expanded_tags::tests::test_parse_expanded_tag_four_segments
  • uv-distribution-filename::expanded_tags::tests::test_parse_expanded_tag_one_segment
  • uv-distribution-filename::expanded_tags::tests::test_parse_expanded_tag_single_segment
  • uv-distribution-filename::expanded_tags::tests::test_parse_expanded_tag_two_segments
uv-requirements-txt: +0 / -2

Added: none

Removed:

  • uv-requirements-txt::test::line_endings::path_new_empty_txt_expects
  • uv-requirements-txt::test::line_endings::path_new_include_b_txt_expects
uv::pip: +0 / -3

Added: none

Removed:

  • uv::pip::pip_install_scenarios::package_prereleases_global_boundary
  • uv::pip::pip_sync::requires_python_direct_url
  • uv::pip::pip_sync::requires_python_editable
uv::pip_compile: +0 / -1

Added: none

Removed:

  • uv::pip_compile::pip_compile::conflicting_url_markers
uv::pip_install: +0 / -1

Added: none

Removed:

  • uv::pip_install::pip_install::invalid_group
uv::python: +0 / -2

Added: none

Removed:

  • uv::python::python_module::find_uv_bin_py312
  • uv::python::venv::create_venv_symlink_recreate_preservation
uv::tool: +0 / -1

Added: none

Removed:

  • uv::tool::tool_upgrade::tool_upgrade_with

@zanieb

zanieb commented Jun 10, 2026

Copy link
Copy Markdown
Member

I'm not sure of the value of, e.g., replacing tool_upgrade::tool_upgrade_with with tool_upgrade::tool_upgrade_pinned_hint, maybe they overlap but their goals are to assert different things?

@zanieb

zanieb commented Jun 10, 2026

Copy link
Copy Markdown
Member

(some of these look good though)

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(())
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deleting this and the above removes all pip sync integration coverage asserting the correct forwarding and rejection of Requires-Python package metadata.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But aside from this, I can't see any issues with removing the rest.

konstin added 2 commits June 11, 2026 11:40
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. |
@konstin konstin force-pushed the konsti/remove-redundant-tests branch from a1c27db to 727cd4b Compare June 11, 2026 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal A refactor or improvement that is not user-facing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants