[pywin32-checkins] pywin32/com/win32com/test testall.py,1.13,1.14
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: <mha...@us...> - 2003-07-03 03:45:51
|
Update of /cvsroot/pywin32/pywin32/com/win32com/test In directory sc8-pr-cvs1:/tmp/cvs-serv28470 Modified Files: testall.py Log Message: Add WMI tests, and generalize test runner code. Index: testall.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testall.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** testall.py 18 Nov 2002 11:20:07 -0000 1.13 --- testall.py 3 Jul 2003 03:45:48 -0000 1.14 *************** *** 3,6 **** --- 3,7 ---- import win32com.client from util import CheckClean + import traceback def GenerateAndRunOldStyle(): *************** *** 20,23 **** --- 21,40 ---- win32com.client.gencache.__init__() # Reset + def _test_with_import(capture, module_name, fn_name, desc): + try: + mod = __import__(module_name) + except (ImportError, pythoncom.com_error): + print "The '%s' test can not be run - failed to import test module" % desc + return + capture.capture() + try: + func = getattr(mod, fn_name) + func() + capture.release() + print "%s generated %d lines of output" % (desc, capture.get_num_lines_captured()) + except: + traceback.print_exc() + capture.release() + print "***** %s test FAILED after %d lines of output" % (desc, capture.get_num_lines_captured()) if __name__=='__main__': *************** *** 44,79 **** testMSOfficeEvents.test() ! capture.capture() ! try: ! import testAccess ! testAccess.test() ! capture.release() ! print "MSAccess test generated %d lines of output" % capture.get_num_lines_captured() ! finally: ! capture.release() ! ! try: ! import testExchange ! except (ImportError, pythoncom.com_error): ! print "The Exchange Server tests can not be run..." ! testExchange = None ! if testExchange is not None: ! capture.capture() ! testExchange.test() ! capture.release() ! print "testExchange test generated %d lines of output" % capture.get_num_lines_captured() ! import testExplorer ! testExplorer.TestAll() ! capture.capture() ! try: ! import testStreams ! testStreams.test() ! capture.release() ! print "testStreams test generated %d lines of output" % capture.get_num_lines_captured() ! finally: ! capture.release() # Execute testPyComTest in its own process so it can play --- 61,73 ---- testMSOfficeEvents.test() ! _test_with_import(capture, "testAccess", "test", "MS Access") ! import testExplorer ! testExplorer.TestAll() + _test_with_import(capture, "testExchange", "test", "MS Exchange") ! _test_with_import(capture, "testStreams", "test", "Streams") ! _test_with_import(capture, "testWMI", "test", "WMI") # Execute testPyComTest in its own process so it can play |