Open junkmd opened 2 years ago
This issue contains restoring tests using InternetExplorer
and have been skipped.
Like below:
def test_remote(self):
obj = comtypes.client.CreateObject(
UIAutomationClient.CUIAutomation().IPersist_GetClassID(),
interface=UIAutomationClient.IUIAutomation,
clsctx=comtypes.CLSCTX_INPROC_SERVER,
machine="localhost")
self.assertTrue(isinstance(obj, POINTER(UIAutomationClient.IUIAutomation)))
self.assertTrue(isinstance(obj, UIAutomationClient.IUIAutomation))
def test_server_info(self):
serverinfo = COSERVERINFO()
serverinfo.pwszName = "localhost"
pServerInfo = byref(serverinfo)
self.assertRaises(
ValueError,
comtypes.client.CreateObject,
UIAutomationClient.CUIAutomation().IPersist_GetClassID(),
machine="localhost",
pServerInfo=pServerInfo)
obj = comtypes.client.CreateObject(
UIAutomationClient.CUIAutomation().IPersist_GetClassID(),
interface=UIAutomationClient.IUIAutomation,
clsctx=comtypes.CLSCTX_INPROC_SERVER,
pServerInfo=pServerInfo)
self.assertTrue(isinstance(obj, POINTER(UIAutomationClient.IUIAutomation)))
self.assertTrue(isinstance(obj, UIAutomationClient.IUIAutomation))
In most cases, I believe that testing the behavior of COM object methods is unnecessary.
When testing methods, including their behavior, we should try them on more primitive objects (such as Scripting.IDictionary
) rather than on objects with more complex necessary conditions (such as UIAutomationClient.CUIAutomation
and some
web browser).
we should try them on more primitive objects
100% concur
test_csesensitivity
import unittest
from comtypes.client import GetModule
GetModule("UIAutomationCore.dll")
from comtypes.gen import UIAutomationClient as uia
class TestCase(unittest.TestCase):
def test(self):
self.assertTrue(issubclass(uia.IUIAutomation2, uia.IUIAutomation))
self.assertTrue(issubclass(uia.IUIAutomation3, uia.IUIAutomation2))
for name in uia.IUIAutomation.__map_case__:
self.assertTrue(name in uia.IUIAutomation2.__map_case__, "%s missing" % name)
self.assertTrue(name in uia.IUIAutomation3.__map_case__, "%s missing" % name)
for name in uia.IUIAutomation2.__map_case__:
self.assertTrue(name in uia.IUIAutomation3.__map_case__, "%s missing" % name)
if __name__ == "__main__":
unittest.main()
import unittest
from comtypes.client import GetModule
GetModule(("{C866CA3A-32F7-11D2-9602-00C04F8EE628}",))
from comtypes.gen import SpeechLib as sapi
class TestCase(unittest.TestCase):
def test(self):
self.assertTrue(issubclass(sapi.IStream, sapi.ISequentialStream))
self.assertTrue(issubclass(sapi.ISpStreamFormat, sapi.IStream))
# names in the base class __map_case__ must also appear in the
# subclass.
for name in sapi.ISequentialStream.__map_case__:
self.assertTrue(name in sapi.IStream.__map_case__, "%s missing" % name)
self.assertTrue(name in sapi.ISpStreamFormat.__map_case__, "%s missing" % name)
for name in sapi.IStream.__map_case__:
self.assertTrue(name in sapi.ISpStreamFormat.__map_case__, "%s missing" % name)
if __name__ == "__main__":
unittest.main()
Internet Explorer will be end of support. https://blogs.windows.com/windowsexperience/2021/05/19/the-future-of-internet-explorer-on-windows-10-is-in-microsoft-edge/
Currently, some tests using IE were skipped, (see https://github.com/enthought/comtypes/issues/267#issuecomment-1029305670 by @dmwyatt, #271, #298)
However, there still remains tests using
shdocvw.dll
(ieframe.dll
), which provides IE and web browser classes. This will likely cause us to inadvertently use the IE class.To be samples for testing, there is no need to use the DLL, and we plan to replace it with something more universal.