From ae755d78bd2092ebe600cb32de3b16729aac95cb Mon Sep 17 00:00:00 2001 From: junkmd Date: Sun, 21 Dec 2025 12:25:49 +0900 Subject: [PATCH 1/5] test: Remove commented-out debug prints from `test_casesensitivity.py`. Removes old, commented-out `print` statements that were used for debugging during development and are no longer needed. This cleans up the test file. --- comtypes/test/test_casesensitivity.py | 9 --------- 1 file changed, 9 deletions(-) diff --git a/comtypes/test/test_casesensitivity.py b/comtypes/test/test_casesensitivity.py index ae93345d4..dabb98660 100644 --- a/comtypes/test/test_casesensitivity.py +++ b/comtypes/test/test_casesensitivity.py @@ -16,18 +16,9 @@ def test(self): # IWebBrowserApp(IWebBrowser) # IWebBrowser2(IWebBrowserApp) - # print iem.IWebBrowser2.mro() - self.assertTrue(issubclass(iem.IWebBrowser2, iem.IWebBrowserApp)) self.assertTrue(issubclass(iem.IWebBrowserApp, iem.IWebBrowser)) - # print sorted(iem.IWebBrowser.__map_case__.keys()) - # print "=" * 42 - # print sorted(iem.IWebBrowserApp.__map_case__.keys()) - # print "=" * 42 - # print sorted(iem.IWebBrowser2.__map_case__.keys()) - # print "=" * 42 - # names in the base class __map_case__ must also appear in the # subclass. for name in iem.IWebBrowser.__map_case__: From f7fd5c217aca1c16019df0510bc29a90a8961365 Mon Sep 17 00:00:00 2001 From: junkmd Date: Sun, 21 Dec 2025 12:25:49 +0900 Subject: [PATCH 2/5] test: Replace Internet Explorer COM objects with `MSVidCtlLib` in `test_casesensitivity.py`. The `test_casesensitivity.py` file has been updated to remove its dependency on Internet Explorer's `shdocvw.dll` COM objects. The test now uses `MSVidCtlLib` interfaces instead. This is part of the ongoing effort to reduce `comtypes`'s reliance on Internet Explorer components in tests. --- comtypes/test/test_casesensitivity.py | 29 +++++++++++++-------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/comtypes/test/test_casesensitivity.py b/comtypes/test/test_casesensitivity.py index dabb98660..0fbaff1bb 100644 --- a/comtypes/test/test_casesensitivity.py +++ b/comtypes/test/test_casesensitivity.py @@ -1,32 +1,31 @@ +import contextlib import unittest from comtypes.client import GetModule -iem = GetModule("shdocvw.dll") +with contextlib.redirect_stdout(None): # supress warnings + GetModule("msvidctl.dll") +from comtypes.gen import MSVidCtlLib as msvidctl class TestCase(unittest.TestCase): def test(self): - from comtypes.client import GetModule - - iem = GetModule("shdocvw.dll") - # IDispatch(IUnknown) - # IWebBrowser(IDispatch) - # IWebBrowserApp(IWebBrowser) - # IWebBrowser2(IWebBrowserApp) + # IMSVidDevice(IDispatch) + # IMSVidInputDevice(IMSVidDevice) + # IMSVidPlayback(IMSVidOutputDevice) - self.assertTrue(issubclass(iem.IWebBrowser2, iem.IWebBrowserApp)) - self.assertTrue(issubclass(iem.IWebBrowserApp, iem.IWebBrowser)) + self.assertTrue(issubclass(msvidctl.IMSVidPlayback, msvidctl.IMSVidInputDevice)) + self.assertTrue(issubclass(msvidctl.IMSVidInputDevice, msvidctl.IMSVidDevice)) # names in the base class __map_case__ must also appear in the # subclass. - for name in iem.IWebBrowser.__map_case__: - self.assertTrue(name in iem.IWebBrowserApp.__map_case__, f"{name} missing") - self.assertTrue(name in iem.IWebBrowser2.__map_case__, f"{name} missing") + for name in msvidctl.IMSVidDevice.__map_case__: + self.assertIn(name, msvidctl.IMSVidInputDevice.__map_case__) + self.assertIn(name, msvidctl.IMSVidPlayback.__map_case__) - for name in iem.IWebBrowserApp.__map_case__: - self.assertTrue(name in iem.IWebBrowser2.__map_case__, f"{name} missing") + for name in msvidctl.IMSVidInputDevice.__map_case__: + self.assertIn(name, msvidctl.IMSVidPlayback.__map_case__) if __name__ == "__main__": From 81bf9d0938c84291453e48de3b500cffd39fb8e0 Mon Sep 17 00:00:00 2001 From: junkmd Date: Sun, 21 Dec 2025 12:25:49 +0900 Subject: [PATCH 3/5] refactor: Rename `test_ie.py` to `test_eventinterface.py` for preparing IE-independent event testing. The `test_ie.py` file is planned for refactoring to test `comtypes`' event handling mechanism without relying on Internet Explorer. The primary goal is to verify how `GetEvents` behaves when the `interface` argument is explicitly specified versus when it is omitted, using an object that has multiple outgoing event interfaces. --- comtypes/test/{test_ie.py => test_eventinterface.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename comtypes/test/{test_ie.py => test_eventinterface.py} (100%) diff --git a/comtypes/test/test_ie.py b/comtypes/test/test_eventinterface.py similarity index 100% rename from comtypes/test/test_ie.py rename to comtypes/test/test_eventinterface.py From ff46ca8e825715c26c557f9e07fc526382a3f091 Mon Sep 17 00:00:00 2001 From: junkmd Date: Sun, 21 Dec 2025 12:25:49 +0900 Subject: [PATCH 4/5] docs: Add test perspective comments to `test_eventinterface.py`. --- comtypes/test/test_eventinterface.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/comtypes/test/test_eventinterface.py b/comtypes/test/test_eventinterface.py index 1e5c60951..fa81561fe 100644 --- a/comtypes/test/test_eventinterface.py +++ b/comtypes/test/test_eventinterface.py @@ -6,6 +6,9 @@ def setUpModule(): + # The primary goal is to verify how `GetEvents` behaves when the + # `interface` argument is explicitly specified versus when it is omitted, + # using an object that has multiple outgoing event interfaces. raise ut.SkipTest( "External test dependencies like this seem bad. Find a different built-in " "win32 API to use." From 02317281d748cbea427b1e28b694492a436dc383 Mon Sep 17 00:00:00 2001 From: junkmd Date: Sun, 21 Dec 2025 12:33:14 +0900 Subject: [PATCH 5/5] build: Update ruff ignores for renamed test file. In `pyproject.toml`, the `per-file-ignores` configuration for ruff has been updated. The entry for `comtypes/test/test_ie.py` is changed to `comtypes/test/test_eventinterface.py` to reflect the recent file rename. --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index ba9e49d68..f9cea138d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -88,7 +88,7 @@ ignore = ["E402"] "comtypes/test/test_agilent.py" = ["F401", "F841"] "comtypes/test/test_client.py" = ["F401"] "comtypes/test/test_dict.py" = ["F841"] -"comtypes/test/test_ie.py" = ["F841"] +"comtypes/test/test_eventinterface.py" = ["F841"] "comtypes/test/test_outparam.py" = ["F841"] "comtypes/test/test_sapi.py" = ["E401"] "comtypes/test/test_server.py" = ["F401", "F841"]