Skip to content

Conversation

@junkmd
Copy link
Collaborator

@junkmd junkmd commented Jan 24, 2026

Overview

This pull request introduces a new test module, test_server_automation.py, dedicated to thoroughly testing server.automation.VARIANTEnumerator.
It includes tests for all essential methods of the IEnumVARIANT interface and ensures proper support for Python's iteration and indexing protocols (__iter__ and __getitem__).

Enhanced Test Coverage and Reliability

Ensures IEnumVARIANT Compliance

The new tests verify the behavior of Next (for both single and multiple item fetches), Skip, Reset, and Clone (confirming E_NOTIMPL where appropriate).
This guarantees that VARIANTEnumerator correctly implements the standard COM enumeration contract, making it a reliable component for COM automation.

Improves Pythonic Integration

By adding tests for __iter__ and __getitem__, this change ensures that VARIANTEnumerator seamlessly integrates with Python's native iterable and sequence protocols.

This commit introduces a new test file `test/test_server_automation.py`
containing `TestVARIANTEnumerator`. This test class verifies the functionality
by creating and enumerating `IDispatch` objects and asserting the correct
behavior of the `Next` method of `IEnumVARIANT`.
Refactored `test_Next` to `test_Next_single_item` and added
`test_Next_multiple_items` to `TestVARIANTEnumerator` in
`test_server_automation.py`. This new test verifies that `IEnumVARIANT.Next`
can correctly fetch multiple items at once, ensuring proper handling of the
`celt` parameter.
This commit introduces a new test method `test_Skip` to
`TestVARIANTEnumerator` in `test_server_automation.py`.
This test verifies the functionality of `IEnumVARIANT.Skip` by
testing various skip scenarios, including skipping zero items, a single
item, and more items than available, asserting correct return values
for `Skip` and subsequent `Next` calls.
This commit introduces a new test method `test_Reset` to
`TestVARIANTEnumerator` in `test/test_server_automation.py`.
This test verifies the functionality of `IEnumVARIANT.Reset` by advancing the
enumerator, resetting it, and then asserting that subsequent `Next` calls
return items from the beginning of the enumeration.
This commit introduces a new test method `test_Clone` to `TestVARIANTEnumerator`
in `test_server_automation.py`.
This test verifies that calling `IEnumVARIANT.Clone` on a `VARIANTEnumerator`
raises a `COMError` with `hresult.E_NOTIMPL`, as the `Clone` method is not
implemented.
This commit introduces new test methods `test_dunder_iter` and
`test_dunder_getitem` to `TestVARIANTEnumerator` in
`test/test_server_automation.py`.
`test_dunder_iter` verifies iteration support for `IEnumVARIANT`
through `VARIANTEnumerator`. `test_dunder_getitem` confirms indexed
access support and proper `IndexError` handling for out-of-bounds access.
@junkmd junkmd added this to the 1.4.16 milestone Jan 24, 2026
@junkmd junkmd added the tests enhance or fix tests label Jan 24, 2026
@codecov
Copy link

codecov bot commented Jan 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.10%. Comparing base (da3634c) to head (ef02545).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #913      +/-   ##
==========================================
+ Coverage   86.64%   87.10%   +0.46%     
==========================================
  Files         133      134       +1     
  Lines       12600    12693      +93     
==========================================
+ Hits        10917    11056     +139     
+ Misses       1683     1637      -46     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@junkmd junkmd merged commit e51ff94 into enthought:main Jan 24, 2026
91 of 101 checks passed
@junkmd junkmd deleted the server_automation_variant_enumerator branch January 24, 2026 07:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tests enhance or fix tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant