Skip to content

Deduplicate test_latest_version tests via parametrize#1596

Merged
nathanjmcdougall merged 2 commits intomainfrom
copilot/reduce-duplication-in-tests
Mar 27, 2026
Merged

Deduplicate test_latest_version tests via parametrize#1596
nathanjmcdougall merged 2 commits intomainfrom
copilot/reduce-duplication-in-tests

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 27, 2026

Seven nearly identical test classes for fallback version checks collapsed into a single parametrized test.

class TestLatestVersion:
    @pytest.mark.usefixtures("_vary_network_conn")
    @pytest.mark.parametrize(
        ("owner", "repo", "expected_tag"),
        [
            ("astral-sh", "uv", FALLBACK_UV_VERSION),
            ("pypa", "hatch", f"hatchling-v{FALLBACK_HATCHLING_VERSION}"),
            # ... 5 more
        ],
        ids=["uv", "hatchling", "pre-commit", "ruff", "sync-with-uv", "codespell", "pyproject-fmt"],
    )
    def test_latest_version(self, owner: str, repo: str, expected_tag: str):
        ...

Net removal of ~78 lines. CI-skip logic, error handling via _skip_on_github_error, and the pyproject-fmt mirror comment are all preserved.


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Copilot AI changed the title [WIP] Refactor test_latest_version tests to reduce duplication Deduplicate test_latest_version tests via parametrize Mar 27, 2026
Copilot AI requested a review from nathanjmcdougall March 27, 2026 10:21
@nathanjmcdougall nathanjmcdougall marked this pull request as ready for review March 27, 2026 10:31
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Mar 27, 2026

Merging this PR will not alter performance

✅ 2 untouched benchmarks


Comparing copilot/reduce-duplication-in-tests (e976a7b) with main (211b0d2)

Open in CodSpeed

@nathanjmcdougall nathanjmcdougall merged commit ee85faf into main Mar 27, 2026
20 checks passed
@nathanjmcdougall nathanjmcdougall deleted the copilot/reduce-duplication-in-tests branch March 27, 2026 11:39
@nathanjmcdougall nathanjmcdougall linked an issue Mar 30, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reduce duplication between test_latest_version tests

2 participants