def setUp(self): from win32com.test.util import RegisterPythonServer from win32com.test import pippo_server RegisterPythonServer(pippo_server.__file__, "Python.Test.Pippo") # create it. self.object = Dispatch("Python.Test.Pippo")
def setUp(self): file = win32api.GetFullPathName( os.path.join(win32com.axscript.client.__path__[0], "pyscript.py")) from win32com.test.util import RegisterPythonServer self.verbose = verbose RegisterPythonServer(file, "python", verbose=self.verbose)
def testit(self): # Check we are registered before spawning the process. from win32com.test import pippo_server RegisterPythonServer(pippo_server.__file__, "Python.Test.Pippo") python = sys.executable fname = os.path.join(os.path.dirname(this_file), "testPippo.py") cmd = '%s "%s" 2>&1' % (python, fname) ExecuteSilentlyIfOK(cmd, self)
def testit(self): # Check that the item is registered, so we get the correct # 'skipped' behaviour (and recorded as such) rather than either # error or silence due to non-registration. RegisterPythonServer(os.path.join(os.path.dirname(__file__), '..', "servers", "test_pycomtest.py"), "Python.Test.PyCOMTest") # Execute testPyComTest in its own process so it can play # with the Python thread state fname = os.path.join(os.path.dirname(this_file), "testPyComTest.py") cmd = '%s "%s" -q 2>&1' % (sys.executable, fname) data = ExecuteSilentlyIfOK(cmd, self)
import win32com.client.connect from win32com.test.util import CheckClean from win32com.client import constants, DispatchBaseClass, CastTo, VARIANT from win32com.test.util import RegisterPythonServer from pywin32_testutil import str2memory import datetime import decimal import win32timezone importMsg = "**** PyCOMTest is not installed ***\n PyCOMTest is a Python test specific COM client and server.\n It is likely this server is not installed on this machine\n To install the server, you must get the win32com sources\n and build it using MS Visual C++" error = Exception # This test uses a Python implemented COM server - ensure correctly registered. RegisterPythonServer( os.path.join(os.path.dirname(__file__), "..", "servers", "test_pycomtest.py"), "Python.Test.PyCOMTest", ) from win32com.client import gencache try: gencache.EnsureModule("{6BCDCB60-5605-11D0-AE5F-CADD4C000000}", 0, 1, 1) except pythoncom.com_error: print("The PyCOMTest module can not be located or generated.") print(importMsg) raise RuntimeError(importMsg) # We had a bg where RegisterInterfaces would fail if gencache had # already been run - exercise that here from win32com import universal
def Register(quiet): import win32com.servers.dictionary from win32com.test.util import RegisterPythonServer RegisterPythonServer(win32com.servers.dictionary.__file__, "Python.Dictionary")
def setUp(self): # Ensure the correct version registered. from win32com.test.util import RegisterPythonServer from win32com.servers import interp RegisterPythonServer(interp.__file__, "Python.Interpreter")