You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Enhance IStorage and IStream testing and refactoring. (#896)
* test: Add `LockRegion`/`UnlockRegion` tests for `IStream`.
Implement new tests for `IStream.LockRegion` and `IStream.UnlockRegion` in
`test_stream.py`. These tests verify the behavior of these methods for both
memory-backed and file-backed streams.
* docs: Clarify `IStream::Revert` behavior in `test_stream.py`.
Add comments to `comtypes/test/test_stream.py` explaining the expected
behavior and limitations of the `IStream::Revert` method.
* refactor: Rename `_create_stream` to `_create_stream_on_hglobal`.
Renamed the helper function `_create_stream` in `comtypes/test/test_stream.py` to
`_create_stream_on_hglobal` to better reflect its purpose of creating a
stream backed by a global memory handle. All usages have been updated.
* test: Use `portabledeviceapi.dll` for `IStorage` tests
Replaced `msvidctl.dll` with `portabledeviceapi.dll` in `test/test_storage.py`
for `IStorage` related tests. This change allows for the removal of the
`contextlib.redirect_stdout` call, as `portabledeviceapi.dll` does not
generate warning messages during module generation, unlike `msvidctl.dll`.
* refactor: Remove unused `OPEN_STM_FLAG` in `test_storage.py`.
The `OPEN_STM_FLAG` constant in `comtypes/test/test_storage.py` was
identified as unused and has been removed to clean up the codebase.
* docs: Explain skipped `IStorage` tests in `test_storage.py`.
Adds comments to `comtypes/test/test_storage.py` to clarify why
`OpenStream` and `EnumElements` are currently skipped due to
difficulties in calling remote-side auto-generated methods.
* refactor: Standardize `IStorage` and `IStream` creation flags
Refactored `Test_IStorage` in `test_storage.py` to introduce new constants.
These constants standardize the creation and access modes for `IStorage`
and `IStream` objects within the tests, improving readability and
reducing redundancy.
* feat: Add `test_SetClass` for `IStorage`.
Introduced `test_SetClass` in `test_storage.py` to verify
the `IStorage.SetClass` method's functionality, including setting and
resetting CLSIDs.
* refactor: Use `cm` for `assertRaises` context managers in `test_storage.py`
Standardize the variable name for `assertRaises` context managers from `ctx`
to `cm` within `comtypes/test/test_storage.py` for consistency.
* test: Add `IStorage.Stat` tests.
Introduced `test_Stat` in `test_storage.py` to thoroughly verify
the behavior of the `IStorage.Stat` method, including error handling
for invalid flags and correct retrieval of `tagSTATSTG` information.
The `_create_docfile` helper method was updated to allow specifying
a file path, enabling more precise control over test document creation
and allowing for the validation of temporary file creation and existence.
0 commit comments