home *** CD-ROM | disk | FTP | other *** search
/ PC World 2002 May / PCWorld_2002-05_cd.bin / Software / TemaCD / activepython / ActivePython-2.1.1.msi / Python21_win32com_test_testAXScript.py < prev    next >
Encoding:
Python Source  |  2001-07-26  |  1.3 KB  |  45 lines

  1. # Test AXScripting the best we can in an automated fashion...
  2. import win32api, win32pipe, os, sys
  3.  
  4. def RegisterEngine(verbose = 1):
  5.     import win32com.axscript.client
  6.     file = win32api.GetFullPathName(os.path.join(win32com.axscript.client.__path__[0], "pyscript.py"))
  7.     cmd = '%s "%s" > nul' % (win32api.GetModuleFileName(0), file)
  8.     if verbose:
  9.         print "Registering engine"
  10. #    print cmd
  11.     rc = os.system(cmd)
  12.     if rc:
  13.         print "Registration of engine failed"
  14.     
  15.     
  16. def TestHost(verbose = 1):
  17.     import win32com.axscript
  18.     file = win32api.GetFullPathName(os.path.join(win32com.axscript.__path__[0], "Test\\TestHost.py"))
  19.     cmd = '%s "%s" > nul' % (win32api.GetModuleFileName(0), file)
  20.     if verbose:
  21.         print "Testing Python Scripting host"
  22. #    print cmd
  23.     rc = os.system(cmd)
  24.     if rc:
  25.         print "Execution of TestHost failed"
  26.  
  27. def TestCScript(verbose = 1):
  28.     import win32com.axscript
  29.     file = win32api.GetFullPathName(os.path.join(win32com.axscript.__path__[0], "Demos\\Client\\wsh\\test.pys"))
  30.     cmd = 'cscript.exe "%s" > nul' % (file)
  31.     if verbose:
  32.         print "Testing Windows Scripting host with Python script"
  33.     rc = os.system(cmd)
  34.     if rc:
  35.         print "Execution of CScript failed"
  36.  
  37. def TestAll(verbose = 1):
  38.     TestHost(verbose)
  39.     TestCScript(verbose)
  40.     
  41. if __name__=='__main__':
  42.     from util import CheckClean
  43.     TestAll()
  44.     CheckClean()
  45.