Update of /cvsroot/pywin32/pywin32/com/win32com/test
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14888/com/win32com/test
Modified Files:
Tag: py3k
errorSemantics.py policySemantics.py testAXScript.py
testArrays.py testClipboard.py testDictionary.py
testExplorer.py testMSOffice.py testPersist.py testPippo.py
testPyComTest.py testServers.py testShell.py testall.py
testvb.py util.py
Log Message:
Merge various changes from trunk and py3k-integration bzr branch
Index: testPippo.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testPippo.py,v
retrieving revision 1.4
retrieving revision 1.4.2.1
diff -C2 -d -r1.4 -r1.4.2.1
*** testPippo.py 3 Jun 2007 13:27:02 -0000 1.4
--- testPippo.py 26 Nov 2008 07:17:39 -0000 1.4.2.1
***************
*** 7,13 ****
class PippoTester(unittest.TestCase):
def setUp(self):
! # register the server
! import pippo_server
! pippo_server.main([pippo_server.__file__])
# create it.
self.object = Dispatch("Python.Test.Pippo")
--- 7,13 ----
class PippoTester(unittest.TestCase):
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")
Index: testArrays.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testArrays.py,v
retrieving revision 1.2
retrieving revision 1.2.4.1
diff -C2 -d -r1.2 -r1.2.4.1
*** testArrays.py 4 May 2004 07:03:04 -0000 1.2
--- testArrays.py 26 Nov 2008 07:17:39 -0000 1.2.4.1
***************
*** 2,6 ****
# arrays patch.
from win32com.client import gencache
! import util
import unittest
--- 2,6 ----
# arrays patch.
from win32com.client import gencache
! from win32com.test import util
import unittest
Index: testServers.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testServers.py,v
retrieving revision 1.5
retrieving revision 1.5.4.1
diff -C2 -d -r1.5 -r1.5.4.1
*** testServers.py 4 May 2004 07:01:44 -0000 1.5
--- testServers.py 26 Nov 2008 07:17:39 -0000 1.5.4.1
***************
*** 11,17 ****
def setUp(self):
# Ensure the correct version registered.
! from win32com.servers.interp import Interpreter
! import win32com.server.register
! win32com.server.register.RegisterClasses(Interpreter, quiet=1)
def _testInterp(self, interp):
--- 11,17 ----
def setUp(self):
# Ensure the correct version registered.
! from win32com.test.util import RegisterPythonServer
! from win32com.servers import interp
! RegisterPythonServer(interp.__file__, "Python.Interpreter")
def _testInterp(self, interp):
Index: policySemantics.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/policySemantics.py,v
retrieving revision 1.4
retrieving revision 1.4.4.1
diff -C2 -d -r1.4 -r1.4.4.1
*** policySemantics.py 10 Nov 2003 00:49:29 -0000 1.4
--- policySemantics.py 26 Nov 2008 07:17:39 -0000 1.4.4.1
***************
*** 23,27 ****
def _Evaluate(self):
# return the sum
! return reduce(lambda a,b: a+b, self.list, 0)
def In(self, value):
return value in self.list
--- 23,27 ----
def _Evaluate(self):
# return the sum
! return sum(self.list)
def In(self, value):
return value in self.list
Index: testPyComTest.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testPyComTest.py,v
retrieving revision 1.32
retrieving revision 1.32.2.1
diff -C2 -d -r1.32 -r1.32.2.1
*** testPyComTest.py 1 Jul 2008 00:11:57 -0000 1.32
--- testPyComTest.py 26 Nov 2008 07:17:39 -0000 1.32.2.1
***************
*** 15,19 ****
# This test uses a Python implemented COM server - ensure correctly registered.
! RegisterPythonServer(os.path.join(os.path.dirname(__file__), '..', "servers", "test_pycomtest.py"))
from win32com.client import gencache
--- 15,20 ----
# 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
Index: util.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/util.py,v
retrieving revision 1.9.2.1
retrieving revision 1.9.2.2
diff -C2 -d -r1.9.2.1 -r1.9.2.2
*** util.py 11 Nov 2008 01:04:19 -0000 1.9.2.1
--- util.py 26 Nov 2008 07:17:39 -0000 1.9.2.2
***************
*** 1,3 ****
--- 1,4 ----
import sys, os
+ import winreg as _winreg
import win32api
import tempfile
***************
*** 14,18 ****
# Ensure no lingering exceptions - Python should have zero outstanding
# COM objects
! sys.exc_clear()
c = _GetInterfaceCount()
if c:
--- 15,22 ----
# Ensure no lingering exceptions - Python should have zero outstanding
# COM objects
! try:
! sys.exc_clear()
! except AttributeError:
! pass # py3k
c = _GetInterfaceCount()
if c:
***************
*** 22,26 ****
print "Warning - %d com gateway objects still alive" % c
! def RegisterPythonServer(filename, verbose=0):
cmd = '%s "%s" --unattended > nul 2>&1' % (win32api.GetModuleFileName(0), filename)
if verbose:
--- 26,77 ----
print "Warning - %d com gateway objects still alive" % c
! def RegisterPythonServer(filename, progids=None, verbose=0):
! if progids:
! if isinstance(progids, basestring):
! progids = [progids]
! # we know the CLSIDs we need, but we might not be an admin user
! # and otherwise unable to register them. So as long as the progids
! # exist and the DLL points at our version, assume it already is.
! why_not = None
! for progid in progids:
! try:
! clsid = pythoncom.MakeIID(progid)
! except pythoncom.com_error:
! # no progid - not registered.
! break
! # have a CLSID - open it.
! try:
! HKCR = _winreg.HKEY_CLASSES_ROOT
! hk = _winreg.OpenKey(HKCR, "CLSID\\%s" % clsid)
! dll = _winreg.QueryValue(hk, "InprocServer32")
! except WindowsError:
! # no CLSID or InProcServer32 - not good!
! break
! if os.path.basename(dll) != os.path.basename(pythoncom.__file__):
! why_not = "%r is registered against a different Python version (%s)" % (progid, dll)
! break
! else:
! #print "Skipping registration of '%s' - already registered" % filename
! return
! # needs registration - see if its likely!
! try:
! from win32com.shell.shell import IsUserAnAdmin
! except ImportError:
! print "Can't import win32com.shell - no idea if you are an admin or not?"
! is_admin = False
! else:
! try:
! is_admin = IsUserAnAdmin()
! except pythoncom.com_error:
! # old, less-secure OS - assume *is* admin.
! is_admin = True
! if not is_admin:
! msg = "%r isn't registered, but I'm not an administrator who can register it." % progids[0]
! if why_not:
! msg += "\n(registration check failed as %s)" % why_not
! # throw a normal "class not registered" exception - we don't report
! # them the same way as "real" errors.
! raise pythoncom.com_error(winerror.CO_E_CLASSSTRING, msg, None, -1)
! # so theoretically we are able to register it.
cmd = '%s "%s" --unattended > nul 2>&1' % (win32api.GetModuleFileName(0), filename)
if verbose:
***************
*** 64,68 ****
func(*args, **kw)
except pythoncom.com_error, details:
! if details[0]==hresult:
return
testcase.fail("Excepected COM exception with HRESULT 0x%x" % hresult)
--- 115,119 ----
func(*args, **kw)
except pythoncom.com_error, details:
! if details.hresult==hresult:
return
testcase.fail("Excepected COM exception with HRESULT 0x%x" % hresult)
***************
*** 176,179 ****
--- 227,260 ----
return test
+ class TestResult(unittest._TextTestResult):
+ def __init__(self, *args, **kw):
+ super(TestResult, self).__init__(*args, **kw)
+ self.num_invalid_clsid = 0
+
+ def addError(self, test, err):
+ """Called when an error has occurred. 'err' is a tuple of values as
+ returned by sys.exc_info().
+ """
+ if isinstance(err[1], pythoncom.com_error) and \
+ err[1].hresult==winerror.CO_E_CLASSSTRING:
+ self.num_invalid_clsid += 1
+ if self.showAll:
+ self.stream.writeln("SKIP")
+ elif self.dots:
+ self.stream.write('S')
+ self.stream.flush()
+ return
+ super(TestResult, self).addError(test, err)
+
+ def printErrors(self):
+ super(TestResult, self).printErrors()
+ if self.num_invalid_clsid:
+ self.stream.writeln("SKIPPED: %d tests due to missing COM objects used for testing" %
+ self.num_invalid_clsid)
+
+ class TestRunner(unittest.TextTestRunner):
+ def _makeResult(self):
+ return TestResult(self.stream, self.descriptions, self.verbosity)
+
# Utilities to set the win32com logger to something what just captures
# records written and doesn't print them.
***************
*** 244,249 ****
def testmain(*args, **kw):
new_kw = kw.copy()
! if not new_kw.has_key('testLoader'):
new_kw['testLoader'] = TestLoader()
unittest.main(*args, **new_kw)
CheckClean()
--- 325,332 ----
def testmain(*args, **kw):
new_kw = kw.copy()
! if 'testLoader' not in new_kw:
new_kw['testLoader'] = TestLoader()
+ if 'testRunner' not in new_kw:
+ new_kw['testRunner'] = TestRunner()
unittest.main(*args, **new_kw)
CheckClean()
Index: testShell.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testShell.py,v
retrieving revision 1.10.4.1
retrieving revision 1.10.4.2
diff -C2 -d -r1.10.4.1 -r1.10.4.2
*** testShell.py 13 Sep 2008 14:40:54 -0000 1.10.4.1
--- testShell.py 26 Nov 2008 07:17:39 -0000 1.10.4.2
***************
*** 4,7 ****
--- 4,12 ----
import copy
+ try:
+ sys_maxsize = sys.maxsize # 2.6 and later - maxsize != maxint on 64bits
+ except AttributeError:
+ sys_maxsize = sys.maxint
+
import win32con
import pythoncom
***************
*** 18,23 ****
shellLink = pythoncom.CoCreateInstance(shell.CLSID_ShellLink, None, pythoncom.CLSCTX_INPROC_SERVER, shell.IID_IShellLink)
persistFile = shellLink.QueryInterface(pythoncom.IID_IPersistFile)
! for base_name in os.listdir(desktop):
! name = os.path.join(desktop, base_name)
try:
persistFile.Load(name,STGM_READ)
--- 23,30 ----
shellLink = pythoncom.CoCreateInstance(shell.CLSID_ShellLink, None, pythoncom.CLSCTX_INPROC_SERVER, shell.IID_IShellLink)
persistFile = shellLink.QueryInterface(pythoncom.IID_IPersistFile)
! names = [os.path.join(desktop, n) for n in os.listdir(desktop)]
! programs = str(shell.SHGetSpecialFolderPath(0, CSIDL_PROGRAMS))
! names.extend([os.path.join(programs, n) for n in os.listdir(programs)])
! for name in names:
try:
persistFile.Load(name,STGM_READ)
***************
*** 31,35 ****
if num == 0:
# This isn't a fatal error, but is unlikely.
! print ("Could not find any links on your desktop, which is unusual")
def testShellFolder(self):
--- 38,42 ----
if num == 0:
# This isn't a fatal error, but is unlikely.
! print ("Could not find any links on your desktop or programs dir, which is unusual")
def testShellFolder(self):
***************
*** 130,134 ****
ftLastAccessTime=pythoncom.MakeTime(11),
ftLastWriteTime=pythoncom.MakeTime(12),
! nFileSize=sys.maxsize + 1)
self._testRT(d)
--- 137,141 ----
ftLastAccessTime=pythoncom.MakeTime(11),
ftLastWriteTime=pythoncom.MakeTime(12),
! nFileSize=sys_maxsize + 1)
self._testRT(d)
***************
*** 145,149 ****
ftLastAccessTime=pythoncom.MakeTime(11),
ftLastWriteTime=pythoncom.MakeTime(12),
! nFileSize=sys.maxsize + 1),
dict(cFileName="foo2.txt",
sizel=(1,2),
--- 152,156 ----
ftLastAccessTime=pythoncom.MakeTime(11),
ftLastWriteTime=pythoncom.MakeTime(12),
! nFileSize=sys_maxsize + 1),
dict(cFileName="foo2.txt",
sizel=(1,2),
***************
*** 153,158 ****
ftLastAccessTime=pythoncom.MakeTime(11),
ftLastWriteTime=pythoncom.MakeTime(12),
! nFileSize=sys.maxsize + 1),
! dict(cFileName="foo\xa9.txt",
sizel=(1,2),
pointl=(3,4),
--- 160,165 ----
ftLastAccessTime=pythoncom.MakeTime(11),
ftLastWriteTime=pythoncom.MakeTime(12),
! nFileSize=sys_maxsize + 1),
! dict(cFileName=u"foo\xa9.txt",
sizel=(1,2),
pointl=(3,4),
***************
*** 161,165 ****
ftLastAccessTime=pythoncom.MakeTime(11),
ftLastWriteTime=pythoncom.MakeTime(12),
! nFileSize=sys.maxsize + 1),
]
s = shell.FILEGROUPDESCRIPTORAsString(d, 1)
--- 168,172 ----
ftLastAccessTime=pythoncom.MakeTime(11),
ftLastWriteTime=pythoncom.MakeTime(12),
! nFileSize=sys_maxsize + 1),
]
s = shell.FILEGROUPDESCRIPTORAsString(d, 1)
Index: testMSOffice.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testMSOffice.py,v
retrieving revision 1.7
retrieving revision 1.7.4.1
diff -C2 -d -r1.7 -r1.7.4.1
*** testMSOffice.py 18 Nov 2002 11:20:06 -0000 1.7
--- testMSOffice.py 26 Nov 2008 07:17:39 -0000 1.7.4.1
***************
*** 21,25 ****
try:
# NOTE - using "client.Dispatch" would return an msword8.py instance!
! print "Starting Word 8 for dynamic test"
word = win32com.client.dynamic.Dispatch("Word.Application")
TestWord8(word)
--- 21,25 ----
try:
# NOTE - using "client.Dispatch" would return an msword8.py instance!
! print ("Starting Word 8 for dynamic test")
word = win32com.client.dynamic.Dispatch("Word.Application")
TestWord8(word)
***************
*** 27,31 ****
word = None
# Now we will test Dispatch without the new "lazy" capabilities
! print "Starting Word 8 for non-lazy dynamic test"
dispatch = win32com.client.dynamic._GetGoodDispatch("Word.Application")
typeinfo = dispatch.GetTypeInfo()
--- 27,31 ----
word = None
# Now we will test Dispatch without the new "lazy" capabilities
! print ("Starting Word 8 for non-lazy dynamic test")
dispatch = win32com.client.dynamic._GetGoodDispatch("Word.Application")
typeinfo = dispatch.GetTypeInfo()
***************
*** 37,45 ****
except pythoncom.com_error:
! print "Starting Word 7 for dynamic test"
word = win32com.client.Dispatch("Word.Basic")
TestWord7(word)
! print "Starting MSWord for generated test"
from win32com.client import gencache
word = gencache.EnsureDispatch("Word.Application.8")
--- 37,45 ----
except pythoncom.com_error:
! print ("Starting Word 7 for dynamic test")
word = win32com.client.Dispatch("Word.Basic")
TestWord7(word)
! print ("Starting MSWord for generated test")
from win32com.client import gencache
word = gencache.EnsureDispatch("Word.Application.8")
***************
*** 82,86 ****
import win32com.test.Generated4Test.msword8
except ImportError:
! print "Can not do old style test"
--- 82,86 ----
import win32com.test.Generated4Test.msword8
except ImportError:
! print ("Can not do old style test")
***************
*** 135,166 ****
def TestAll():
! try:
! TestWord()
!
! print "Starting Excel for Dynamic test..."
! xl = win32com.client.dynamic.Dispatch("Excel.Application")
! TextExcel(xl)
! try:
! print "Starting Excel 8 for generated excel8.py test..."
! mod = gencache.EnsureModule("{00020813-0000-0000-C000-000000000046}", 0, 1, 2, bForDemand=1)
! xl = win32com.client.Dispatch("Excel.Application")
! TextExcel(xl)
! except ImportError:
! print "Could not import the generated Excel 97 wrapper"
! try:
! import xl5en32
! mod = gencache.EnsureModule("{00020813-0000-0000-C000-000000000046}", 9, 1, 0)
! xl = win32com.client.Dispatch("Excel.Application.5")
! print "Starting Excel 95 for makepy test..."
! TextExcel(xl)
! except ImportError:
! print "Could not import the generated Excel 95 wrapper"
! except KeyboardInterrupt:
! print "*** Interrupted MSOffice test ***"
! except:
! traceback.print_exc()
if __name__=='__main__':
--- 135,160 ----
def TestAll():
! TestWord()
! print ("Starting Excel for Dynamic test...")
! xl = win32com.client.dynamic.Dispatch("Excel.Application")
! TextExcel(xl)
! try:
! print ("Starting Excel 8 for generated excel8.py test...")
! mod = gencache.EnsureModule("{00020813-0000-0000-C000-000000000046}", 0, 1, 2, bForDemand=1)
! xl = win32com.client.Dispatch("Excel.Application")
! TextExcel(xl)
! except ImportError:
! print ("Could not import the generated Excel 97 wrapper")
! try:
! import xl5en32
! mod = gencache.EnsureModule("{00020813-0000-0000-C000-000000000046}", 9, 1, 0)
! xl = win32com.client.Dispatch("Excel.Application.5")
! print ("Starting Excel 95 for makepy test...")
! TextExcel(xl)
! except ImportError:
! print ("Could not import the generated Excel 95 wrapper")
if __name__=='__main__':
Index: errorSemantics.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/errorSemantics.py,v
retrieving revision 1.6
retrieving revision 1.6.4.1
diff -C2 -d -r1.6 -r1.6.4.1
*** errorSemantics.py 7 Sep 2004 02:10:49 -0000 1.6
--- errorSemantics.py 26 Nov 2008 07:17:39 -0000 1.6.4.1
***************
*** 32,36 ****
def Commit(self, flags):
! raise "foo"
def test():
--- 32,36 ----
def Commit(self, flags):
! raise Exception("foo")
def test():
***************
*** 39,46 ****
try:
com_server.Clone()
! except pythoncom.com_error, com_exc:
! hr, desc, exc, argErr = com_exc
! if hr != winerror.E_UNEXPECTED:
raise error("Calling the object natively did not yield the correct scode", com_exc)
if not exc or exc[-1] != winerror.E_UNEXPECTED:
raise error("The scode element of the exception tuple did not yield the correct scode", com_exc)
--- 39,47 ----
try:
com_server.Clone()
! raise error("Expecting this call to fail!")
! except pythoncom.com_error as com_exc:
! if com_exc.hresult != winerror.E_UNEXPECTED:
raise error("Calling the object natively did not yield the correct scode", com_exc)
+ exc = com_exc.excepinfo
if not exc or exc[-1] != winerror.E_UNEXPECTED:
raise error("The scode element of the exception tuple did not yield the correct scode", com_exc)
***************
*** 54,62 ****
finally:
cap.release()
! except pythoncom.com_error, com_exc:
! hr, desc, exc, argErr = com_exc
! if hr != winerror.E_FAIL:
raise error("The hresult was not E_FAIL for an internal error", com_exc)
! if exc[1] != "Python COM Server Internal Error":
raise error("The description in the exception tuple did not yield the correct string", com_exc)
# Check we saw a traceback in stderr
--- 55,63 ----
finally:
cap.release()
! raise error("Expecting this call to fail!")
! except pythoncom.com_error as com_exc:
! if com_exc.hresult != winerror.E_FAIL:
raise error("The hresult was not E_FAIL for an internal error", com_exc)
! if com_exc.excepinfo[1] != "Python COM Server Internal Error":
raise error("The description in the exception tuple did not yield the correct string", com_exc)
# Check we saw a traceback in stderr
***************
*** 68,75 ****
try:
com_server.Clone()
! except pythoncom.com_error, com_exc:
! hr, desc, exc, argErr = com_exc
! if hr != winerror.DISP_E_EXCEPTION:
raise error("Calling the object via IDispatch did not yield the correct scode", com_exc)
if not exc or exc[-1] != winerror.E_UNEXPECTED:
raise error("The scode element of the exception tuple did not yield the correct scode", com_exc)
--- 69,77 ----
try:
com_server.Clone()
! raise error("Expecting this call to fail!")
! except pythoncom.com_error as com_exc:
! if com_exc.hresult != winerror.DISP_E_EXCEPTION:
raise error("Calling the object via IDispatch did not yield the correct scode", com_exc)
+ exc = com_exc.excepinfo
if not exc or exc[-1] != winerror.E_UNEXPECTED:
raise error("The scode element of the exception tuple did not yield the correct scode", com_exc)
***************
*** 84,91 ****
finally:
cap.release()
! except pythoncom.com_error, com_exc:
! hr, desc, exc, argErr = com_exc
! if hr != winerror.DISP_E_EXCEPTION:
raise error("Calling the object via IDispatch did not yield the correct scode", com_exc)
if not exc or exc[-1] != winerror.E_FAIL:
raise error("The scode element of the exception tuple did not yield the correct scode", com_exc)
--- 86,94 ----
finally:
cap.release()
! raise error("Expecting this call to fail!")
! except pythoncom.com_error as com_exc:
! if com_exc.hresult != winerror.DISP_E_EXCEPTION:
raise error("Calling the object via IDispatch did not yield the correct scode", com_exc)
+ exc = com_exc.excepinfo
if not exc or exc[-1] != winerror.E_FAIL:
raise error("The scode element of the exception tuple did not yield the correct scode", com_exc)
Index: testvb.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testvb.py,v
retrieving revision 1.20
retrieving revision 1.20.4.1
diff -C2 -d -r1.20 -r1.20.4.1
*** testvb.py 21 Nov 2006 06:56:04 -0000 1.20
--- testvb.py 26 Nov 2008 07:17:39 -0000 1.20.4.1
***************
*** 8,29 ****
from win32com.server.util import NewCollection, wrap
import string
! import util
!
! importMsg = """\
! **** VB Test harness is not installed ***
! This test requires a VB test program to be built and installed
! on this PC.
! """
!
! ### NOTE: VB SUCKS!
! ### If you delete the DLL built by VB, then reopen VB
! ### to rebuild the DLL, it loses the IID of the object!!!
! ### So I will try to avoid this in the future :-)
!
! # Import the type library for the test module.
! try:
! win32com.client.gencache.EnsureDispatch("PyCOMVBTest.Tester")
! except pythoncom.com_error:
! raise RuntimeError, importMsg
import traceback
--- 8,12 ----
from win32com.server.util import NewCollection, wrap
import string
! from win32com.test import util
import traceback
***************
*** 34,38 ****
## useDispatcher = win32com.server.dispatcher.DefaultDebugDispatcher
! error = "VB Test Error"
# Set up a COM object that VB will do some callbacks on. This is used
--- 17,21 ----
## useDispatcher = win32com.server.dispatcher.DefaultDebugDispatcher
! error = RuntimeError
# Set up a COM object that VB will do some callbacks on. This is used
***************
*** 78,100 ****
vbtest.LongProperty = -1
if vbtest.LongProperty != -1:
! raise error, "Could not set the long property correctly."
vbtest.IntProperty = 10
if vbtest.IntProperty != 10:
! raise error, "Could not set the integer property correctly."
vbtest.VariantProperty = 10
if vbtest.VariantProperty != 10:
! raise error, "Could not set the variant integer property correctly."
vbtest.VariantProperty = buffer('raw\0data')
if vbtest.VariantProperty != buffer('raw\0data'):
! raise error, "Could not set the variant buffer property correctly."
vbtest.StringProperty = "Hello from Python"
if vbtest.StringProperty != "Hello from Python":
! raise error, "Could not set the string property correctly."
vbtest.VariantProperty = "Hello from Python"
if vbtest.VariantProperty != "Hello from Python":
! raise error, "Could not set the variant string property correctly."
vbtest.VariantProperty = (1.0, 2.0, 3.0)
if vbtest.VariantProperty != (1.0, 2.0, 3.0):
! raise error, "Could not set the variant property to an array of floats correctly - '%s'." % (vbtest.VariantProperty,)
TestArrays(vbtest, bUseGenerated)
--- 61,83 ----
vbtest.LongProperty = -1
if vbtest.LongProperty != -1:
! raise error("Could not set the long property correctly.")
vbtest.IntProperty = 10
if vbtest.IntProperty != 10:
! raise error("Could not set the integer property correctly.")
vbtest.VariantProperty = 10
if vbtest.VariantProperty != 10:
! raise error("Could not set the variant integer property correctly.")
vbtest.VariantProperty = buffer('raw\0data')
if vbtest.VariantProperty != buffer('raw\0data'):
! raise error("Could not set the variant buffer property correctly.")
vbtest.StringProperty = "Hello from Python"
if vbtest.StringProperty != "Hello from Python":
! raise error("Could not set the string property correctly.")
vbtest.VariantProperty = "Hello from Python"
if vbtest.VariantProperty != "Hello from Python":
! raise error("Could not set the variant string property correctly.")
vbtest.VariantProperty = (1.0, 2.0, 3.0)
if vbtest.VariantProperty != (1.0, 2.0, 3.0):
! raise error("Could not set the variant property to an array of floats correctly - '%s'." % (vbtest.VariantProperty,))
TestArrays(vbtest, bUseGenerated)
***************
*** 113,117 ****
vbtest.VariantPutref = vbtest
if vbtest.VariantPutref._oleobj_!= vbtest._oleobj_:
! raise error, "Could not set the VariantPutref property correctly."
# Cant test further types for this VariantPutref, as only
# COM objects can be stored ByRef.
--- 96,100 ----
vbtest.VariantPutref = vbtest
if vbtest.VariantPutref._oleobj_!= vbtest._oleobj_:
! raise error("Could not set the VariantPutref property correctly.")
# Cant test further types for this VariantPutref, as only
# COM objects can be stored ByRef.
***************
*** 122,131 ****
# vbtest.CollectionProperty = NewCollection((1,2,"3", "Four"))
# if vbtest.CollectionProperty != (1,2,"3", "Four"):
! # raise error, "Could not set the Collection property correctly - got back " + str(vbtest.CollectionProperty)
# These are sub's that have a single byref param
# Result should be just the byref.
if vbtest.IncrementIntegerParam(1) != 2:
! raise error, "Could not pass an integer byref"
# Sigh - we cant have *both* "ommited byref" and optional args
--- 105,114 ----
# vbtest.CollectionProperty = NewCollection((1,2,"3", "Four"))
# if vbtest.CollectionProperty != (1,2,"3", "Four"):
! # raise error("Could not set the Collection property correctly - got back " + str(vbtest.CollectionProperty))
# These are sub's that have a single byref param
# Result should be just the byref.
if vbtest.IncrementIntegerParam(1) != 2:
! raise error("Could not pass an integer byref")
# Sigh - we cant have *both* "ommited byref" and optional args
***************
*** 133,143 ****
# rather than simply all byrefs working as optional.
# if vbtest.IncrementIntegerParam() != 1:
! # raise error, "Could not pass an omitted integer byref"
if vbtest.IncrementVariantParam(1) != 2:
! raise error, "Could not pass an int VARIANT byref:"+str(vbtest.IncrementVariantParam(1))
if vbtest.IncrementVariantParam(1.5) != 2.5:
! raise error, "Could not pass a float VARIANT byref"
# Can't test IncrementVariantParam with the param omitted as it
--- 116,126 ----
# rather than simply all byrefs working as optional.
# if vbtest.IncrementIntegerParam() != 1:
! # raise error("Could not pass an omitted integer byref")
if vbtest.IncrementVariantParam(1) != 2:
! raise error("Could not pass an int VARIANT byref:"+str(vbtest.IncrementVariantParam(1)))
if vbtest.IncrementVariantParam(1.5) != 2.5:
! raise error("Could not pass a float VARIANT byref")
# Can't test IncrementVariantParam with the param omitted as it
***************
*** 148,152 ****
ret = vbtest.PassIntByVal(1)
if ret != 2:
! raise error, "Could not increment the integer - "+str(ret)
TestVBInterface(vbtest)
--- 131,135 ----
ret = vbtest.PassIntByVal(1)
if ret != 2:
! raise error("Could not increment the integer - "+str(ret))
TestVBInterface(vbtest)
***************
*** 157,166 ****
ret = vbtest.PassIntByRef(1)
if ret != (1,2):
! raise error, "Could not increment the integer - "+str(ret)
# Check you can leave a byref arg blank.
# see above
# ret = vbtest.PassIntByRef()
# if ret != (0,1):
! # raise error, "Could not increment the integer with default arg- "+str(ret)
def _DoTestCollection(vbtest, col_name, expected):
--- 140,149 ----
ret = vbtest.PassIntByRef(1)
if ret != (1,2):
! raise error("Could not increment the integer - "+str(ret))
# Check you can leave a byref arg blank.
# see above
# ret = vbtest.PassIntByRef()
# if ret != (0,1):
! # raise error("Could not increment the integer with default arg- "+str(ret))
def _DoTestCollection(vbtest, col_name, expected):
***************
*** 176,180 ****
check.append(item)
if check != list(expected):
! raise error, "Collection %s didn't have %r (had %r)" % (col_name, expected, check)
# Just looping over the collection again works (ie, is restartable)
check = []
--- 159,163 ----
check.append(item)
if check != list(expected):
! raise error("Collection %s didn't have %r (had %r)" % (col_name, expected, check))
# Just looping over the collection again works (ie, is restartable)
check = []
***************
*** 182,186 ****
check.append(item)
if check != list(expected):
! raise error, "Collection 2nd time around %s didn't have %r (had %r)" % (col_name, expected, check)
# Check we can get it via iter()
i = iter(getattr(vbtest, col_name))
--- 165,169 ----
check.append(item)
if check != list(expected):
! raise error("Collection 2nd time around %s didn't have %r (had %r)" % (col_name, expected, check))
# Check we can get it via iter()
i = iter(getattr(vbtest, col_name))
***************
*** 189,193 ****
check.append(item)
if check != list(expected):
! raise error, "Collection iterator %s didn't have %r 2nd time around (had %r)" % (col_name, expected, check)
# but an iterator is not restartable
check = []
--- 172,176 ----
check.append(item)
if check != list(expected):
! raise error("Collection iterator %s didn't have %r 2nd time around (had %r)" % (col_name, expected, check))
# but an iterator is not restartable
check = []
***************
*** 195,204 ****
check.append(item)
if check != []:
! raise error, "2nd time around Collection iterator %s wasn't empty (had %r)" % (col_name, check)
# Check len()==Count()
c = getattr(vbtest, col_name)
if len(c) != _getcount(c):
! raise error, "Collection %s __len__(%r) wasn't==Count(%r)" % (col_name, len(c), _getcount(c))
# Check we can do it with zero based indexing.
c = getattr(vbtest, col_name)
--- 178,187 ----
check.append(item)
if check != []:
! raise error("2nd time around Collection iterator %s wasn't empty (had %r)" % (col_name, check))
# Check len()==Count()
c = getattr(vbtest, col_name)
if len(c) != _getcount(c):
! raise error("Collection %s __len__(%r) wasn't==Count(%r)" % (col_name, len(c), _getcount(c)))
# Check we can do it with zero based indexing.
c = getattr(vbtest, col_name)
***************
*** 207,211 ****
check.append(c[i])
if check != list(expected):
! raise error, "Collection %s didn't have %r (had %r)" % (col_name, expected, check)
# Check we can do it with our old "Skip/Next" methods.
--- 190,194 ----
check.append(c[i])
if check != list(expected):
! raise error("Collection %s didn't have %r (had %r)" % (col_name, expected, check))
# Check we can do it with our old "Skip/Next" methods.
***************
*** 218,222 ****
check.append(n[0])
if check != list(expected):
! raise error, "Collection %s didn't have %r (had %r)" % (col_name, expected, check)
def TestCollections(vbtest):
--- 201,205 ----
check.append(n[0])
if check != list(expected):
! raise error("Collection %s didn't have %r (had %r)" % (col_name, expected, check))
def TestCollections(vbtest):
***************
*** 224,228 ****
# zero based indexing works for simple VB collections.
if vbtest.CollectionProperty[0] != 1:
! raise error, "The CollectionProperty[0] element was not the default value"
_DoTestCollection(vbtest, "EnumerableCollectionProperty", [])
--- 207,211 ----
# zero based indexing works for simple VB collections.
if vbtest.CollectionProperty[0] != 1:
! raise error("The CollectionProperty[0] element was not the default value")
_DoTestCollection(vbtest, "EnumerableCollectionProperty", [])
***************
*** 236,247 ****
vbtest.ArrayProperty = data
if expected_exception is not None:
! raise error, "Expected '%s'" % expected_exception
except expected_exception:
return
got = vbtest.ArrayProperty
if got != data:
! raise error, \
! "Could not set the array data correctly - got %r, expected %r" \
! % (got, data)
def TestArrays(vbtest, bUseGenerated):
--- 219,230 ----
vbtest.ArrayProperty = data
if expected_exception is not None:
! raise error("Expected '%s'" % expected_exception)
except expected_exception:
return
got = vbtest.ArrayProperty
if got != data:
! raise error(
! "Could not set the array data correctly - got %r, expected %r"
! % (got, data))
def TestArrays(vbtest, bUseGenerated):
***************
*** 314,320 ****
byRefParam = map(str, byRefParam)
if testData != list(resultData):
! raise error, "The safe array data was not what we expected - got " + str(resultData)
if testData != list(byRefParam):
! raise error, "The safe array data was not what we expected - got " + str(byRefParam)
testData = [1.0, 2.0, 3.0]
resultData, byRefParam = vbtest.PassSAFEARRAYVariant(testData)
--- 297,303 ----
byRefParam = map(str, byRefParam)
if testData != list(resultData):
! raise error("The safe array data was not what we expected - got " + str(resultData))
if testData != list(byRefParam):
! raise error("The safe array data was not what we expected - got " + str(byRefParam))
testData = [1.0, 2.0, 3.0]
resultData, byRefParam = vbtest.PassSAFEARRAYVariant(testData)
***************
*** 336,367 ****
try:
vbtest.IntProperty = "One"
! raise error, "Should have failed by now"
except pythoncom.com_error, (hr, desc, exc, argErr):
if hr != winerror.DISP_E_TYPEMISMATCH:
! raise error, "Expected DISP_E_TYPEMISMATCH"
s = vbtest.StructProperty
if s.int_val != 99 or str(s.str_val) != "hello":
! raise error, "The struct value was not correct"
s.str_val = "Hi from Python"
s.int_val = 11
if s.int_val != 11 or str(s.str_val) != "Hi from Python":
! raise error, "The struct value didnt persist!"
if s.sub_val.int_val != 66 or str(s.sub_val.str_val) != "sub hello":
! raise error, "The sub-struct value was not correct"
sub = s.sub_val
sub.int_val = 22
if sub.int_val != 22:
print sub.int_val
! raise error, "The sub-struct value didnt persist!"
if s.sub_val.int_val != 22:
print s.sub_val.int_val
! raise error, "The sub-struct value (re-fetched) didnt persist!"
if s.sub_val.array_val[0].int_val != 0 or str(s.sub_val.array_val[0].str_val) != "zero":
print s.sub_val.array_val[0].int_val
! raise error, "The array element wasnt correct"
s.sub_val.array_val[0].int_val = 99
s.sub_val.array_val[1].int_val = 66
--- 319,350 ----
try:
vbtest.IntProperty = "One"
! raise error("Should have failed by now")
except pythoncom.com_error, (hr, desc, exc, argErr):
if hr != winerror.DISP_E_TYPEMISMATCH:
! raise error("Expected DISP_E_TYPEMISMATCH")
s = vbtest.StructProperty
if s.int_val != 99 or str(s.str_val) != "hello":
! raise error("The struct value was not correct")
s.str_val = "Hi from Python"
s.int_val = 11
if s.int_val != 11 or str(s.str_val) != "Hi from Python":
! raise error("The struct value didnt persist!")
if s.sub_val.int_val != 66 or str(s.sub_val.str_val) != "sub hello":
! raise error("The sub-struct value was not correct")
sub = s.sub_val
sub.int_val = 22
if sub.int_val != 22:
print sub.int_val
! raise error("The sub-struct value didnt persist!")
if s.sub_val.int_val != 22:
print s.sub_val.int_val
! raise error("The sub-struct value (re-fetched) didnt persist!")
if s.sub_val.array_val[0].int_val != 0 or str(s.sub_val.array_val[0].str_val) != "zero":
print s.sub_val.array_val[0].int_val
! raise error("The array element wasnt correct")
s.sub_val.array_val[0].int_val = 99
s.sub_val.array_val[1].int_val = 66
***************
*** 369,373 ****
s.sub_val.array_val[1].int_val != 66:
print s.sub_val.array_val[0].int_val
! raise error, "The array element didnt persist."
# Now pass the struct back to VB
vbtest.StructProperty = s
--- 352,356 ----
s.sub_val.array_val[1].int_val != 66:
print s.sub_val.array_val[0].int_val
! raise error("The array element didnt persist.")
# Now pass the struct back to VB
vbtest.StructProperty = s
***************
*** 375,381 ****
s = vbtest.StructProperty
if s.int_val != 11 or str(s.str_val) != "Hi from Python":
! raise error, "After sending to VB, the struct value didnt persist!"
if s.sub_val.array_val[0].int_val != 99:
! raise error, "After sending to VB, the struct array value didnt persist!"
# Now do some object equality tests.
--- 358,364 ----
s = vbtest.StructProperty
if s.int_val != 11 or str(s.str_val) != "Hi from Python":
! raise error("After sending to VB, the struct value didnt persist!")
if s.sub_val.array_val[0].int_val != 99:
! raise error("After sending to VB, the struct array value didnt persist!")
# Now do some object equality tests.
***************
*** 415,419 ****
try:
s.bad_attribute
! raise RuntimeError, "Could get a bad attribute"
except AttributeError:
pass
--- 398,402 ----
try:
s.bad_attribute
! raise RuntimeError("Could get a bad attribute")
except AttributeError:
pass
***************
*** 427,434 ****
t = ob.GetInterfaceTester(2)
if t.getn() != 2:
! raise error, "Initial value wrong"
t.setn(3)
if t.getn() != 3:
! raise error, "New value wrong"
def DoTestAll():
--- 410,417 ----
t = ob.GetInterfaceTester(2)
if t.getn() != 2:
! raise error("Initial value wrong")
t.setn(3)
if t.getn() != 3:
! raise error("New value wrong")
def DoTestAll():
***************
*** 440,451 ****
def TestAll():
if not __debug__:
! raise RuntimeError, "This must be run in debug mode - we use assert!"
try:
DoTestAll()
print "All tests appear to have worked!"
except:
print "TestAll() failed!!"
traceback.print_exc()
# Make this test run under our test suite to leak tests etc work
--- 423,440 ----
def TestAll():
+ # Import the type library for the test module. Let the 'invalid clsid'
+ # exception filter up, where the test runner will treat it as 'skipped'
+ win32com.client.gencache.EnsureDispatch("PyCOMVBTest.Tester")
+
if not __debug__:
! raise RuntimeError("This must be run in debug mode - we use assert!")
try:
DoTestAll()
print "All tests appear to have worked!"
except:
+ # ?????
print "TestAll() failed!!"
traceback.print_exc()
+ raise
# Make this test run under our test suite to leak tests etc work
Index: testClipboard.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testClipboard.py,v
retrieving revision 1.2
retrieving revision 1.2.4.1
diff -C2 -d -r1.2 -r1.2.4.1
*** testClipboard.py 4 May 2004 07:02:30 -0000 1.2
--- testClipboard.py 26 Nov 2008 07:17:39 -0000 1.2.4.1
***************
*** 46,50 ****
if cf == win32con.CF_TEXT:
ret_stg = pythoncom.STGMEDIUM()
! ret_stg.set(pythoncom.TYMED_HGLOBAL, self.strval)
elif cf == win32con.CF_UNICODETEXT:
ret_stg = pythoncom.STGMEDIUM()
--- 46,51 ----
if cf == win32con.CF_TEXT:
ret_stg = pythoncom.STGMEDIUM()
! # ensure always 'bytes' by encoding string.
! ret_stg.set(pythoncom.TYMED_HGLOBAL, self.strval.encode("ascii"))
elif cf == win32con.CF_UNICODETEXT:
ret_stg = pythoncom.STGMEDIUM()
***************
*** 110,114 ****
win32clipboard.OpenClipboard()
got = win32clipboard.GetClipboardData(win32con.CF_TEXT)
! self.assertEqual(got, "Hello from Python")
# Now check unicode
got = win32clipboard.GetClipboardData(win32con.CF_UNICODETEXT)
--- 111,117 ----
win32clipboard.OpenClipboard()
got = win32clipboard.GetClipboardData(win32con.CF_TEXT)
! # CF_TEXT gives bytes on py3k - use encode() to ensure that's true.
! expected = "Hello from Python".encode("ascii")
! self.assertEqual(got, expected)
# Now check unicode
got = win32clipboard.GetClipboardData(win32con.CF_UNICODETEXT)
***************
*** 118,122 ****
def testWin32ToCom(self):
# Set the data via the std win32 clipboard functions.
! val = "Hello again!"
win32clipboard.OpenClipboard()
win32clipboard.SetClipboardData(win32con.CF_TEXT, val)
--- 121,125 ----
def testWin32ToCom(self):
# Set the data via the std win32 clipboard functions.
! val = "Hello again!".encode("ascii") # ensure always bytes, even in py3k
win32clipboard.OpenClipboard()
win32clipboard.SetClipboardData(win32con.CF_TEXT, val)
***************
*** 130,134 ****
# knowing if it meant to be a string, or a binary buffer, so
# it must return it too.
! self.failUnlessEqual(got, val+"\0")
def testDataObjectFlush(self):
--- 133,137 ----
# knowing if it meant to be a string, or a binary buffer, so
# it must return it too.
! self.failUnlessEqual(got, "Hello again!\0".encode("ascii"))
def testDataObjectFlush(self):
***************
*** 152,155 ****
if __name__=='__main__':
! import util
util.testmain()
--- 155,158 ----
if __name__=='__main__':
! from win32com.test import util
util.testmain()
Index: testall.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testall.py,v
retrieving revision 1.27.2.1
retrieving revision 1.27.2.2
diff -C2 -d -r1.27.2.1 -r1.27.2.2
*** testall.py 11 Nov 2008 01:04:19 -0000 1.27.2.1
--- testall.py 26 Nov 2008 07:17:39 -0000 1.27.2.2
***************
*** 2,7 ****
import pythoncom
import win32com.client
! from util import CheckClean, TestCase, CapturingFunctionTestCase, TestLoader
! import win32com.test.util
import traceback
import getopt
--- 2,8 ----
import pythoncom
import win32com.client
! from win32com.test.util import CheckClean, TestCase, \
! CapturingFunctionTestCase, ShellTestCase, \
! TestLoader, TestRunner, RegisterPythonServer
import traceback
import getopt
***************
*** 58,61 ****
--- 59,68 ----
no_leak_tests = True # done by the test itself
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
***************
*** 66,69 ****
--- 73,80 ----
class PippoTest(TestCase):
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")
***************
*** 123,128 ****
mod_name = test_name
func_name = None
try:
! mod = __import__(mod_name)
except:
import_failures.append((mod_name, sys.exc_info()[:2]))
--- 134,141 ----
mod_name = test_name
func_name = None
+ fq_mod_name = "win32com.test." + mod_name
try:
! __import__(fq_mod_name)
! mod = sys.modules[fq_mod_name]
except:
import_failures.append((mod_name, sys.exc_info()[:2]))
***************
*** 145,150 ****
continue
if func is not None:
! test = win32com.test.util.CapturingFunctionTestCase(func,
! description=mod_name)
else:
if hasattr(mod, "suite"):
--- 158,162 ----
continue
if func is not None:
! test = CapturingFunctionTestCase(func, description=mod_name)
else:
if hasattr(mod, "suite"):
***************
*** 155,159 ****
suite.addTest(test)
for cmd, output in output_checked_programs[i]:
! suite.addTest(win32com.test.util.ShellTestCase(cmd, output))
for test_class in custom_test_cases[i]:
--- 167,171 ----
suite.addTest(test)
for cmd, output in output_checked_programs[i]:
! suite.addTest(ShellTestCase(cmd, output))
for test_class in custom_test_cases[i]:
***************
*** 202,206 ****
# A little row of markers so the dots show how close to finished
print '|' * suite.countTestCases()
! testRunner = unittest.TextTestRunner(verbosity=verbosity)
testResult = testRunner.run(suite)
if import_failures:
--- 214,218 ----
# A little row of markers so the dots show how close to finished
print '|' * suite.countTestCases()
! testRunner = TestRunner(verbosity=verbosity)
testResult = testRunner.run(suite)
if import_failures:
Index: testExplorer.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testExplorer.py,v
retrieving revision 1.7
retrieving revision 1.7.2.1
diff -C2 -d -r1.7 -r1.7.2.1
*** testExplorer.py 19 Jul 2008 06:23:40 -0000 1.7
--- testExplorer.py 26 Nov 2008 07:17:39 -0000 1.7.2.1
***************
*** 9,16 ****
import win32gui
import win32con
import glob
import pythoncom
import time
! from util import CheckClean
bVisibleEventFired = 0
--- 9,17 ----
import win32gui
import win32con
+ import winerror
import glob
import pythoncom
import time
! from win32com.test.util import CheckClean
bVisibleEventFired = 0
***************
*** 48,52 ****
'Internet Explorer_Server']:
hwnd = win32gui.FindWindowEx(hwnd, 0, child_class, None)
! assert hwnd, "Couldn't find '%s" % (child_class,)
# But here is the point - once you have an 'Internet Explorer_Server',
# you can send a message and use ObjectFromLresult to get it back.
--- 49,53 ----
'Internet Explorer_Server']:
hwnd = win32gui.FindWindowEx(hwnd, 0, child_class, None)
! assert hwnd, "Couldn't find '%s'" % (child_class,)
# But here is the point - once you have an 'Internet Explorer_Server',
# you can send a message and use ObjectFromLresult to get it back.
***************
*** 74,96 ****
def TestAll():
try:
! iexplore = win32com.client.dynamic.Dispatch("InternetExplorer.Application")
! TestExplorer(iexplore)
!
! win32api.Sleep(1000)
! iexplore = None
! # Test IE events.
! TestExplorerEvents()
! # Give IE a chance to shutdown, else it can get upset on fast machines.
! time.sleep(2)
! # Note that the TextExplorerEvents will force makepy - hence
! # this gencache is really no longer needed.
! from win32com.client import gencache
! gencache.EnsureModule("{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}", 0, 1, 1)
! iexplore = win32com.client.Dispatch("InternetExplorer.Application")
! TestExplorer(iexplore)
finally:
iexplore = None
--- 75,100 ----
def TestAll():
try:
! try:
! iexplore = win32com.client.dynamic.Dispatch("InternetExplorer.Application")
! TestExplorer(iexplore)
! win32api.Sleep(1000)
! iexplore = None
! # Test IE events.
! TestExplorerEvents()
! # Give IE a chance to shutdown, else it can get upset on fast machines.
! time.sleep(2)
! # Note that the TextExplorerEvents will force makepy - hence
! # this gencache is really no longer needed.
+ from win32com.client import gencache
+ gencache.EnsureModule("{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}", 0, 1, 1)
+ iexplore = win32com.client.Dispatch("InternetExplorer.Application")
+ TestExplorer(iexplore)
+ except pythoncom.com_error as exc:
+ if exc.hresult!=winerror.RPC_E_DISCONNECTED: # user closed the app!
+ raise
finally:
iexplore = None
Index: testAXScript.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testAXScript.py,v
retrieving revision 1.7
retrieving revision 1.7.4.1
diff -C2 -d -r1.7 -r1.7.4.1
*** testAXScript.py 10 Nov 2003 00:49:29 -0000 1.7
--- testAXScript.py 26 Nov 2008 07:17:39 -0000 1.7.4.1
***************
*** 15,19 ****
from util import RegisterPythonServer
self.verbose = verbose
! RegisterPythonServer(file, self.verbose)
def testHost(self):
--- 15,19 ----
from util import RegisterPythonServer
self.verbose = verbose
! RegisterPythonServer(file, 'python', verbose=self.verbose)
def testHost(self):
***************
*** 32,34 ****
if __name__=='__main__':
! unittest.main()
--- 32,34 ----
if __name__=='__main__':
! win32com.test.util.testmain()
Index: testDictionary.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testDictionary.py,v
retrieving revision 1.6
retrieving revision 1.6.4.1
diff -C2 -d -r1.6 -r1.6.4.1
*** testDictionary.py 10 Nov 2003 00:49:29 -0000 1.6
--- testDictionary.py 26 Nov 2008 07:17:39 -0000 1.6.4.1
***************
*** 9,13 ****
import pywintypes
import winerror
- L=pywintypes.Unicode
import unittest
--- 9,12 ----
***************
*** 25,31 ****
# Ensure we have the correct version registered.
def Register(quiet):
! import win32com.server.register
! from win32com.servers.dictionary import DictionaryPolicy
! win32com.server.register.RegisterClasses(DictionaryPolicy, quiet=quiet)
def TestDict(quiet=None):
--- 24,30 ----
# Ensure we have the correct version registered.
def Register(quiet):
! import win32com.servers.dictionary
! from win32com.test.util import RegisterPythonServer
! RegisterPythonServer(win32com.servers.dictionary.__file__, 'Python.Dictionary')
def TestDict(quiet=None):
Index: testPersist.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testPersist.py,v
retrieving revision 1.2
retrieving revision 1.2.4.1
diff -C2 -d -r1.2 -r1.2.4.1
*** testPersist.py 18 Nov 2002 11:20:07 -0000 1.2
--- testPersist.py 26 Nov 2008 07:17:39 -0000 1.2.4.1
***************
*** 1,5 ****
import pythoncom
import win32com.server.util
- import util
import time
--- 1,4 ----
|