Add CIMRepository open coverage and align _FormatFilenameAsGlob call sites with its return value - #37
Open
kev365 wants to merge 2 commits into
Open
Add CIMRepository open coverage and align _FormatFilenameAsGlob call sites with its return value#37kev365 wants to merge 2 commits into
kev365 wants to merge 2 commits into
Conversation
…sites _FormatFilenameAsGlob() returns a single string. Six call sites in CIMRepository took two values from it, which is reached when Open() is called. Adds CIMRepositoryTest.testOpenAndClose using the existing test_data/cim corpus, resolving the "TODO: add tests for CIMRepository" note, and takes the single returned value at the six call sites so that the new test exercises Open() end to end. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <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.
Motivation
CIMRepositoryis the entry point for reading a WMI CIM repository, andtests/wmi_repository.pycurrently carries
# TODO: add tests for CIMRepository. This adds that coverage using thetest_data/cimcorpus already in the repository.Adding a test that calls
CIMRepository.Open()also exercises the six_FormatFilenameAsGlob()call sites, which is where the second half of this change applies.
Current behavior (verified, for reference)
_FormatFilenameAsGlob()returns a single string:Six call sites take two values from it:
mapping{n}.mapindex.btr_OpenMappingFile)mapping.verobjects.datacim.repCalling
CIMRepository.Open()againsttest_data/cimat4917c9b:The existing tests cover
IndexBinaryTreeFile,MappingFileandObjectsDataFiledirectly, sothis path is not currently reached by the suite.
Proposed change
CIMRepositoryTest.testOpenAndClose, using the existingtest_data/cimcorpus, resolvingthe existing TODO.
Verification
Re-run from a clean working copy against
4917c9b:dtformats/wmi_repository.py; 16 added and 1 removed intests/wmi_repository.py(the removed line is the# TODO: add tests for CIMRepositorycomment this resolves)ValueErrorabovepython -m unittest tests.wmi_repositoryscripts/wmi_repository.py <repository>Backward compatibility
No format, API, or output change.
_FormatFilenameAsGlob()itself is unchanged; only thecall sites and the test module are touched.