diff --git a/comtypes/client/lazybind.py b/comtypes/client/lazybind.py index 85716d01..1aae8933 100644 --- a/comtypes/client/lazybind.py +++ b/comtypes/client/lazybind.py @@ -159,11 +159,7 @@ def __getattr__(self, name): def caller(*args): return self._comobj._invoke(descr.memid, descr.invkind, 0, *args) - try: - caller.__name__ = name - except TypeError: - # In Python 2.3, __name__ is readonly - pass + caller.__name__ = name return caller def __setattr__(self, name, value): diff --git a/comtypes/test/__init__.py b/comtypes/test/__init__.py index 2cb5332e..afe19a1d 100644 --- a/comtypes/test/__init__.py +++ b/comtypes/test/__init__.py @@ -37,37 +37,9 @@ class ResourceDenied(Exception): """ -def is_resource_enabled(resource): - """Test whether a resource is enabled. - - If the caller's module is __main__ then automatically return True.""" - if sys._getframe().f_back.f_globals.get("__name__") == "__main__": - return True - result = use_resources is not None and ( - resource in use_resources or "*" in use_resources - ) - if not result: - _unavail[resource] = None - return result - - _unavail = {} -def requires(resource, msg=None): - """Raise ResourceDenied if the specified resource is not available. - - If the caller's module is __main__ then automatically return True.""" - # see if the caller's module is __main__ - if so, treat as if - # the resource was set - if sys._getframe().f_back.f_globals.get("__name__") == "__main__": - return - if not is_resource_enabled(resource): - if msg is None: - msg = f"Use of the `{resource}` resource not enabled" - raise ResourceDenied(msg) - - def find_package_modules(package, mask): import fnmatch diff --git a/comtypes/test/test_subinterface.py b/comtypes/test/test_subinterface.py index cd279ea6..6d8bde32 100644 --- a/comtypes/test/test_subinterface.py +++ b/comtypes/test/test_subinterface.py @@ -1,14 +1,7 @@ -import sys import unittest -from ctypes import * +from ctypes import c_void_p -from comtypes import GUID, IUnknown - - -def test_main(): - from test import test_support - - test_support.run_unittest(Test) +from comtypes import IUnknown class Test(unittest.TestCase):