-
-
Notifications
You must be signed in to change notification settings - Fork 104
Enhance COM Moniker, Bind Context and Running Object Table Test Coverage #912
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+312
−5
Conversation
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
Introduces `Test_IsEqual` class to `test/test_moniker.py` to verify the correct functionality of `IsEqual` method for monikers. This test ensures that monikers with identical item IDs are correctly identified as equal, while those with different item IDs are not.
Introduces `Test_Hash` class to `test/test_moniker.py` to verify the correct functionality of the `Hash` method for monikers. This test ensures that monikers with identical item IDs produce the same hash value, while those with different item IDs produce different hash values.
Introduces `Test_ComposeWith` to `test/test_moniker.py` to verify the `ComposeWith` method. This test ensures that composing item monikers results in a `CLSID_CompositeMoniker`. It also validates that when `fOnlyIfNotGeneric=True`, `ComposeWith` correctly raises a `COMError` with `MK_E_NEEDGENERIC`, indicating that the moniker cannot be composed generically. Constants `CLSID_CompositeMoniker` and `MK_E_NEEDGENERIC` were added to `test/monikers_helper.py` to support this test.
Introduces `Test_Enum` class with `test_generic_composite` method to `test/test_moniker.py`. This test verifies the `Enum` method of composite monikers, ensuring it correctly returns an `IEnumMoniker` instance. It uses the newly added `_CreateGenericComposite` helper in `test/monikers_helper.py`.
This test verifies the correct behavior of `IsSystemMoniker`, `GetDisplayName`, `GetClassID`, and `Inverse` methods for generic composite monikers. The `MKSYS_GENERICCOMPOSITE` constant was added to `monikers_helper.py` to support this test.
Introduces `Test_RemoteBindToObject` class with `test_file` method to `test/test_moniker.py`. This test verifies the `RemoteBindToObject` method for file monikers, ensuring correct binding to `IPersistFile`. The `_CreateFileMoniker` helper function was added to `monikers_helper.py` to support this test.
Introduces `test_file` method to `Test_IsSystemMoniker_GetDisplayName_Inverse` in `test/test_moniker.py`. This test verifies the correct behavior of `IsSystemMoniker`, `GetDisplayName`, `GetClassID`, and `Inverse` methods for file monikers. The `MKSYS_FILEMONIKER` and `CLSID_FileMoniker` constants were added to `monikers_helper.py` to support this test.
Introduces `Test_CommonPrefixWith` class with `test_file` method to `test/test_moniker.py`. This test verifies the `CommonPrefixWith` method for file monikers, ensuring it correctly identifies the common directory path between different file monikers.
Introduces `Test_RelativePathTo` class with `test_file` method to `/test/test_moniker.py`. This test verifies the `RelativePathTo` method for file monikers, ensuring it correctly calculates the relative path between two file monikers, mirroring `pathlib.Path.relative_to`.
…dOptions`. This commit introduces a new test class `Test_Set_Get_BindOptions` to `test/test_bctx.py`. It verifies the correct functionality of `SetBindOptions` and `GetBindOptions` by setting and retrieving `tagBIND_OPTS2` values and asserting their correctness.
…thods. This commit introduces a new test class `Test_Get_Register_Revoke_ObjectParam` to `test/test_bctx.py`. It verifies the functionality of `GetObjectParam`, `RegisterObjectParam`, and `RevokeObjectParam` by registering and revoking a COM object and asserting its presence or absence.
This commit introduces a new test class to `test/test_bctx.py`. It verifies the functionality of `RegisterObjectBound`, `RevokeObjectBound`, and `ReleaseBoundObjects` by registering and unregistering a COM object within the bind context.
Add `_get_long_path_name` to `test_moniker.py`. This change ensures consistent path normalization across test environments, preventing failures due to short path vs. long path discrepancies.
Replaced the dynamic calculation of relative paths using `Path.relative_to` with a literal string in `Test_RelativePathTo.test_file`. This simplifies the test logic and resolves the `TypeError` caused by `walk_up=True` in older Python environments, aligning with the goal of reducing complexity.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #912 +/- ##
==========================================
+ Coverage 86.45% 86.64% +0.18%
==========================================
Files 133 133
Lines 12428 12600 +172
==========================================
+ Hits 10745 10917 +172
Misses 1683 1683 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Overview
This pull request expands the test coverage for COM Moniker functionalities. It introduces new test cases and helper functions to validate behaviors of
IMoniker,IBindCtx, andIRunningObjectTableinterfaces, ensuring robust and reliable interactions with COM objects.Value Proposition
Comprehensive Functionality Testing
Previously, several core methods lacked dedicated test coverage. This change introduces new tests.
Improved Helper Functions and Constants
To facilitate these tests, necessary COM constants like
MKSYS_GENERICCOMPOSITE, along with helper functions like_CreateGenericComposite, have been exposed, improving the testability and clarity of COM interactions.This extensive test suite provides a higher degree of assurance in the correctness and stability for systems relying on these fundamental COM mechanisms.