test: add coverage for fetch_indexes_from_main - #45
Open
darthmelonder wants to merge 1 commit into
Open
Conversation
3 tasks
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.
Summary
TestFetchIndexesFromMainclass intests/test_doc_index.pycoveringfetch_indexes_from_main()insrc/doc_index.py.git fetchfailure, no index tracked on the base branch (emptyls-treestdout),ls-treenon-zero return,git checkoutfailure, and unexpected exceptions.DOCS_BASE_BRANCH, emptyDOCS_BASE_BRANCHfallback tomain, andDOCS_SUBFOLDERproducing prefixed index paths (docs/.doc-index).TestCheckoutDocsFromBaseBranchclass — usespatch("doc_index.run_command_safe")with a class-level_mock_githelper that returns aside_effectsimulating the three git commands._mock_githelper raisesAssertionErroron any git command it doesn't explicitly handle, so future refactors that introduce a new git call will fail the tests loudly rather than silently pass with a benign default."No cached indexes/summaries found","Could not fetch","Could not checkout indexes","Error fetching indexes from main") viacapsys, so a regression in the diagnostic output is caught.Closes #42
Test plan
uv run ruff check src/ tests/— clean.uv run ruff format --check src/ tests/— clean.