Skip to content

Commit

Permalink
refreeze server32-windows.exe and fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jborbely committed Mar 27, 2024
1 parent bdf08d2 commit 5fca79b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 36 deletions.
Binary file modified msl/loadlib/server32-windows.exe
Binary file not shown.
24 changes: 7 additions & 17 deletions tests/server32_comtypes/activex_media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,33 +13,23 @@

class ActiveX(Server32):

def __init__(self, host, port, **kwargs):
def __init__(self, host, port):
super().__init__(prog_id, 'activex', host, port)
self._app = Application()

def this(self):
return self.lib.IsSoundCardEnabled()

def static(self):
return Application.load(prog_id).IsSoundCardEnabled()
def reload(self):
return self._app.load(prog_id).IsSoundCardEnabled()

def create(self):
return Application().load(prog_id).IsSoundCardEnabled()

def parent(self):
app = Application()
return app.load(prog_id, parent=app).IsSoundCardEnabled()

def panel(self):
app = Application()
panel = app.create_panel()
return app.load(prog_id, parent=panel).IsSoundCardEnabled()

def load_library(self):
@staticmethod
def load_library():
return LoadLibrary(prog_id, 'activex').lib.IsSoundCardEnabled()

def error1(self):
try:
Application.load('ABC.DEF.GHI')
self._app.load('ABC.DEF.GHI')
except OSError as e:
return str(e)
else:
Expand Down
24 changes: 6 additions & 18 deletions tests/test_server32.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ def test_server32_error():
c.add('hello', 'world')
except loadlib.Server32Error as err:
assert err.name == 'ArgumentError'
assert err.value.endswith("TypeError: wrong type")
assert 'argument 1: TypeError:' in err.value
assert err.traceback.endswith('return self.lib.add(a, b)')


Expand Down Expand Up @@ -303,17 +303,8 @@ def __init__(self):
def this(self):
return self.request32('this')

def static(self):
return self.request32('static')

def create(self):
return self.request32('create')

def parent(self):
return self.request32('parent')

def panel(self):
return self.request32('panel')
def reload(self):
return self.request32('reload')

def load_library(self):
return self.request32('load_library')
Expand All @@ -328,13 +319,10 @@ def error2(self):

# don't care whether the value is True or False only that it is a boolean
assert isinstance(ax.this(), bool)
assert isinstance(ax.static(), bool)
assert isinstance(ax.create(), bool)
assert isinstance(ax.parent(), bool)
assert isinstance(ax.panel(), bool)
assert isinstance(ax.reload(), bool)
assert isinstance(ax.load_library(), bool)
assert ax.error1().endswith("Cannot find 'ABC.DEF.GHI' for libtype='activex'")
assert ax.error2().endswith("Cannot find 'ABC.DEF.GHI' for libtype='activex'")
assert ax.error1().endswith("Cannot find an ActiveX library with ID 'ABC.DEF.GHI'")
assert ax.error2().endswith("Cannot find an ActiveX library with ID 'ABC.DEF.GHI'")

# no numpy warnings from comtypes
out, err = ax.shutdown_server32()
Expand Down
2 changes: 1 addition & 1 deletion tests/test_server32_bad_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def test_bad_lib_path():

@skipif_no_server32
def test_bad_lib_type():
check('bad_lib_type', r"Cannot load libtype='invalid'")
check('bad_lib_type', r"ValueError: Invalid libtype 'invalid'")


@skipif_no_server32
Expand Down

0 comments on commit 5fca79b

Please sign in to comment.