Skip to content

Commit 6732c26

Browse files
authored
remove skip marks (enthought#452)
1 parent 446f52e commit 6732c26

File tree

1 file changed

+42
-33
lines changed

1 file changed

+42
-33
lines changed

comtypes/test/test_client.py

Lines changed: 42 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import unittest as ut
66

77
import comtypes.client
8-
from comtypes import COSERVERINFO
8+
from comtypes import COSERVERINFO, CLSCTX_INPROC_SERVER
99

1010
# create the typelib wrapper and import it
1111
comtypes.client.GetModule("scrrun.dll")
@@ -143,46 +143,55 @@ def test_clsid_string(self):
143143
comtypes.client.CreateObject(text_type(Scripting.Dictionary._reg_clsid_))
144144
comtypes.client.CreateObject(str(Scripting.Dictionary._reg_clsid_))
145145

146-
@ut.skip(
147-
"This test uses IE which is not available on all machines anymore. "
148-
"Find another API to use."
149-
)
150146
def test_remote(self):
151-
ie = comtypes.client.CreateObject(
152-
"InternetExplorer.Application", machine="localhost"
147+
comtypes.client.GetModule("UIAutomationCore.dll")
148+
from comtypes.gen.UIAutomationClient import (
149+
CUIAutomation,
150+
IUIAutomation,
151+
IUIAutomationElement,
153152
)
154-
self.assertEqual(ie.Visible, False)
155-
ie.Visible = 1
156-
# on a remote machine, this may not work. Probably depends on
157-
# how the server is run.
158-
self.assertEqual(ie.Visible, True)
159-
self.assertEqual(0, ie.Quit()) # 0 == S_OK
160-
161-
@ut.skip(
162-
"This test uses IE which is not available on all machines anymore. "
163-
"Find another API to use."
164-
)
153+
154+
iuia = comtypes.client.CreateObject(
155+
CUIAutomation().IPersist_GetClassID(),
156+
interface=IUIAutomation,
157+
clsctx=CLSCTX_INPROC_SERVER,
158+
machine="localhost",
159+
)
160+
self.assertIsInstance(iuia, POINTER(IUIAutomation))
161+
self.assertIsInstance(iuia, IUIAutomation)
162+
self.assertIsInstance(iuia.GetRootElement(), POINTER(IUIAutomationElement))
163+
self.assertIsInstance(iuia.GetRootElement(), IUIAutomationElement)
164+
165165
def test_server_info(self):
166+
comtypes.client.GetModule("UIAutomationCore.dll")
167+
from comtypes.gen.UIAutomationClient import (
168+
CUIAutomation,
169+
IUIAutomation,
170+
IUIAutomationElement,
171+
)
172+
166173
serverinfo = COSERVERINFO()
167174
serverinfo.pwszName = "localhost"
168175
pServerInfo = byref(serverinfo)
169-
170-
self.assertRaises(
171-
ValueError,
172-
comtypes.client.CreateObject,
173-
"InternetExplorer.Application",
174-
machine="localhost",
176+
with self.assertRaises(ValueError):
177+
# cannot set both the machine name and server info
178+
comtypes.client.CreateObject(
179+
CUIAutomation().IPersist_GetClassID(),
180+
interface=IUIAutomation,
181+
clsctx=CLSCTX_INPROC_SERVER,
182+
machine="localhost",
183+
pServerInfo=pServerInfo,
184+
)
185+
iuia = comtypes.client.CreateObject(
186+
CUIAutomation().IPersist_GetClassID(),
187+
interface=IUIAutomation,
188+
clsctx=CLSCTX_INPROC_SERVER,
175189
pServerInfo=pServerInfo,
176190
)
177-
ie = comtypes.client.CreateObject(
178-
"InternetExplorer.Application", pServerInfo=pServerInfo
179-
)
180-
self.assertEqual(ie.Visible, False)
181-
ie.Visible = 1
182-
# on a remote machine, this may not work. Probably depends on
183-
# how the server is run.
184-
self.assertEqual(ie.Visible, True)
185-
self.assertEqual(0, ie.Quit()) # 0 == S_OK
191+
self.assertIsInstance(iuia, POINTER(IUIAutomation))
192+
self.assertIsInstance(iuia, IUIAutomation)
193+
self.assertIsInstance(iuia.GetRootElement(), POINTER(IUIAutomationElement))
194+
self.assertIsInstance(iuia.GetRootElement(), IUIAutomationElement)
186195

187196

188197
class Test_Constants(ut.TestCase):

0 commit comments

Comments
 (0)