Skip to content

Commit

Permalink
Update setUpModule and add tearDownModule.
Browse files Browse the repository at this point in the history
  • Loading branch information
junkmd committed Dec 6, 2024
1 parent 56bdac2 commit 4b11bc8
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions comtypes/test/test_dispinterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,23 @@
import unittest

import comtypes.test.TestDispServer
from comtypes.server.register import register # , unregister
from comtypes.server.register import register, unregister


def setUpModule():
raise unittest.SkipTest(
"This test requires the tests to be run as admin since it tries to "
"register the test COM server. Is this a good idea?"
)
try:
register(comtypes.test.TestDispServer.TestDispServer)
except WindowsError as e:
if e.winerror != 5: # [Error 5] Access is denied
raise e
raise unittest.SkipTest(
"This test requires the tests to be run as admin since it tries to "
"register the test COM server."
)


# If this test is ever NOT skipped, then this line needs to run. Keeping it here for posterity.
register(comtypes.test.TestDispServer.TestDispServer)
def tearDownModule():
unregister(comtypes.test.TestDispServer.TestDispServer)


@unittest.skip("This depends on 'pywin32'.")
Expand Down

0 comments on commit 4b11bc8

Please sign in to comment.