Skip to content

Replace Internet Explorer with MSXML in test_eventinterface.py.#933

Merged
junkmd merged 9 commits intoenthought:mainfrom
junkmd:remove_ie_from_eventinterface_test
Mar 7, 2026
Merged

Replace Internet Explorer with MSXML in test_eventinterface.py.#933
junkmd merged 9 commits intoenthought:mainfrom
junkmd:remove_ie_from_eventinterface_test

Conversation

@junkmd
Copy link
Collaborator

@junkmd junkmd commented Mar 7, 2026

related to #302

Overview

This PR replaces the dependency on InternetExplorer.Application in test_eventinterface.py with Msxml2.DOMDocument.
This change ensures that the test suite can run reliably on modern Windows environments where Internet Explorer is no longer supported.
The PR also introduces the IPropertyNotifySink interface definition and enhances documentation across the test file.

Improved maintainability and clarity

Explicit documentation of test intent

The refactored tests now include detailed comments explaining why MSXML is used and what each test case verifies (e.g., default vs. non-default source interfaces).
This makes the test logic transparent for new contributors and simplifies future debugging of event-related issues.

Consistent resource management

By centralizing imports like gc and time and adding explanatory comments about resource cleanup in tearDown.

junkmd added 9 commits March 7, 2026 23:36
…erface.py`.

- Relocate `import gc` and `import time` to the top of the file.
- Removes redundant inline imports from `tearDown` and test methods.
….py`.

- Replaces `InternetExplorer.Application` with `Msxml2.DOMDocument`.
- Introduces `IPropertyNotifySink` and `MSXMLDocumentSink` for testing.
- Updates test methods to verify default and non-default event interfaces
  using `MSXML`.
…erface.py`.

- Document `OnChanged` and `OnRequestEdit` methods in `IPropertyNotifySink`
  with descriptions from official documentation to improve code clarity.
- Add descriptive comments to `IPropertyNotifySink` and `MSXMLDocumentSink`
  methods.
- Clarify whether methods originate from the default dispatch interface or
  the `IPropertyNotifySink` interface.
- Clarify in `Test_MSXML.setUp` why `Msxml2.DOMDocument` is chosen as
  the test object, highlighting its support for multiple connection points.
- Add comments to `Test_MSXML` methods explaining the behavior of `GetEvents`
  when connecting to default vs. non-default source interfaces.
- Add a comment explaining the use of `gc.collect()` and `time.sleep()`
  in `Test_MSXML.tearDown` to ensure reliable COM resource release.
…rface.py`.

- Clarify message loop processing during event wait.
- Document expected event arrivals for default vs. non-default interfaces.
@junkmd junkmd added this to the 1.4.17 milestone Mar 7, 2026
@junkmd junkmd added the tests enhance or fix tests label Mar 7, 2026
@codecov
Copy link

codecov bot commented Mar 7, 2026

Codecov Report

❌ Patch coverage is 93.93939% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.91%. Comparing base (069b9d1) to head (492d6f7).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
comtypes/test/test_eventinterface.py 93.93% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #933      +/-   ##
==========================================
+ Coverage   88.59%   88.91%   +0.32%     
==========================================
  Files         139      139              
  Lines       13613    13606       -7     
==========================================
+ Hits        12060    12098      +38     
+ Misses       1553     1508      -45     

☔ 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 5c416b8 into enthought:main Mar 7, 2026
52 checks passed
@junkmd junkmd deleted the remove_ie_from_eventinterface_test branch March 7, 2026 22:46
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