Fix _make_mock_winreg and add registry-path unit tests - #34
Open
kwuuuuu wants to merge 2 commits into
Open
Conversation
The _make_mock_winreg helper existed but was never wired to any tests because its open_key stub only handled the initial hive-constant call and always raised OSError for the subkey open, making the registry branch unreachable. Fixed the helper to distinguish both call forms and added TestFindInstallationsRegistry covering: single install found, multiple versions sorted, deduplication with filesystem, missing exe skipped, and hive-absent fallthrough to filesystem. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Tests for revit_available=False (error path), extra fields in active status responses, and unknown keys in error responses were absent. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.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.
What changed
_make_mock_winregintests/unit/test_find_installations.pyexisted but was never wired to any test cases. The helper had a bug:winreg.OpenKeyis called twice per subkey once with an integer hive constant to open the base key and again with the returned handle to open the named subkey. The original stub only handled the hive-constant form and always raised OSError for the subkey open making the entire registry branch of_find_revit_installationsunreachable from tests.What this PR does
_make_mock_winregto distinguish both OpenKey call forms so subkeys can actually be opened and queried.TestFindInstallationsRegistrywith 5 new tests: single install found, multiple versions sorted newest-first, deduplication with filesystem, missing exe skipped, and hive-absent fallthrough to filesystem.Test results
69 passed (was 64), 0 failures.
Reviewer notes
No production code changed. This is a test-coverage fix for the primary discovery strategy (Windows Registry) which had zero unit test coverage.