perf(test): optimize git checkouts in pypi tests#5035
Merged
baszalmstra merged 4 commits intoprefix-dev:mainfrom Dec 3, 2025
Merged
perf(test): optimize git checkouts in pypi tests#5035baszalmstra merged 4 commits intoprefix-dev:mainfrom
baszalmstra merged 4 commits intoprefix-dev:mainfrom
Conversation
Replace GitHub-based git dependency tests with a local git fixture that's dynamically created at test time. This eliminates network dependency and significantly improves test performance. Changes: - Add GitRepoFixture helper that creates git repos from versioned fixture directories (001_v0.1.0, 002_v0.2.0, etc.) - Add fixture files in tests/data/git-fixtures/minimal-pypi-package/ - Update tests to use GitRepoFixture with dynamic commit hashes - Remove explicit with_no_install(false) calls since tests only verify lock file contents Performance: ~39s -> ~5s (90% faster)
- Extract GitRepoFixture to git_fixture.rs for better organization - Store all commit hashes in a Vec instead of just first/latest - Add first_commit() and latest_commit() helper methods - Update tests to use method calls and pass fixture name
5 tasks
Hofer-Julian
approved these changes
Dec 3, 2025
Contributor
Hofer-Julian
left a comment
There was a problem hiding this comment.
Looks great.
I had two comments, feel free to ignore and merge if you disagree
Co-authored-by: Hofer-Julian <30049909+Hofer-Julian@users.noreply.github.com>
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.
Description
Optimizes the git PyPI update tests by replacing network-dependent GitHub clones with a local git fixture. The tests previously took 11-15 seconds each due to cloning from GitHub. Now they complete in ~4-5 seconds using a local fixture.
Changes:
GitRepoFixturehelper that creates temporary git repositories from versioned fixture directories (e.g.,001_v0.1.0/,002_v0.2.0/)tests/data/git-fixtures/minimal-pypi-package/without embedded.gitdirectoryno_installmode since these tests only verify lock file contents, not package installationurl::Url::from_directory_path()for Windows compatibilityBefore: ~39 seconds total (3 tests × ~13s each, hitting GitHub)
After: ~14 seconds total (3 tests × ~4.5s each, local only)
How Has This Been Tested?
All 3 tests pass:
test_update_conda_package_doesnt_update_git_pypi: 5.1stest_update_conda_package_doesnt_update_git_pypi_pinned: 4.3stest_update_git_pypi_when_requested: 4.7sAI Disclosure
Tools: Claude Code
Checklist: