From: Thomas H. <th...@us...> - 2008-04-17 18:20:16
|
Update of /cvsroot/py2exe/py2exe/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14650 Modified Files: test_noZipFile.py test_EasyDialogs.py test_2+2.py test.py Added Files: test_xml_xpath.py test_win32com_shell.py test_sys_path.py setup_win32com_shell.py Removed Files: test_xml.xpath.py test_win32com.shell.py test_sys.path.py setup_win32com.shell.py Log Message: Rename the tests so that they are valid Python modules - no dot in the filename except for the extension. Change the tests: Move the imports to the top, and move the actual test code inside a "if __name__ == '__main__':" block. Change the test runner in test/test.py so that it skips test scripts that cannot be imported as modules. Print out info about failed assertions. --- NEW FILE: test_win32com_shell.py --- from win32com.shell import shellcon, shell if __name__ == "__main__": print shell.SHGetFolderPath(0, shellcon.CSIDL_DESKTOP, 0, 0) Index: test.py =================================================================== RCS file: /cvsroot/py2exe/py2exe/test/test.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** test.py 5 Apr 2008 11:26:42 -0000 1.7 --- test.py 17 Apr 2008 18:20:07 -0000 1.8 *************** *** 79,85 **** print ' ', test # Execute script to get baseline baseline = run(sys.executable, test) - basename = os.path.splitext(test)[0] exe = os.path.join('dist', basename + '.exe') exe2 = os.path.join('dist', basename + '_2.exe') --- 79,91 ---- print ' ', test + basename = os.path.splitext(test)[0] + try: + __import__(basename) + except ImportError, details: + print "(Skipping %s: %s)" % (basename, details) + continue + # Execute script to get baseline baseline = run(sys.executable, test) exe = os.path.join('dist', basename + '.exe') exe2 = os.path.join('dist', basename + '_2.exe') *************** *** 98,102 **** # Run exe and test against baseline os.rename(exe, exe2) # ensure that the exe works when renamed ! assert run(exe2) == baseline clean() --- 104,112 ---- # Run exe and test against baseline os.rename(exe, exe2) # ensure that the exe works when renamed ! out2 = run(exe2) ! if out2 != baseline: ! print "FAILED." ! print "\tExpected:", baseline ! print "\tGot:", out2 clean() --- test_xml.xpath.py DELETED --- --- NEW FILE: test_xml_xpath.py --- # This tests http://sourceforge.net/project/showfiles.php?group_id=6473 import xml.xpath if __name__ == "__main__": print xml.xpath.Init() Index: test_2+2.py =================================================================== RCS file: /cvsroot/py2exe/py2exe/test/test_2+2.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_2+2.py 13 Feb 2006 13:54:07 -0000 1.1 --- test_2+2.py 17 Apr 2008 18:20:07 -0000 1.2 *************** *** 1 **** ! print 2+2 --- 1,2 ---- ! if __name__ == "__main__": ! print 2+2 --- NEW FILE: setup_win32com_shell.py --- import sys # ModuleFinder can't handle runtime changes to __path__, but win32com uses them try: import modulefinder import win32com for p in win32com.__path__[1:]: modulefinder.AddPackagePath("win32com", p) for extra in ["win32com.shell"]: #,"win32com.mapi" __import__(extra) m = sys.modules[extra] for p in m.__path__[1:]: modulefinder.AddPackagePath(extra, p) except ImportError: # no build path setup, no worries. pass from distutils.core import setup import py2exe setup( script_args=['py2exe', '%s'], console=['%s'], ) --- test_sys.path.py DELETED --- --- setup_win32com.shell.py DELETED --- --- test_win32com.shell.py DELETED --- Index: test_EasyDialogs.py =================================================================== RCS file: /cvsroot/py2exe/py2exe/test/test_EasyDialogs.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_EasyDialogs.py 13 Feb 2006 13:54:07 -0000 1.1 --- test_EasyDialogs.py 17 Apr 2008 18:20:07 -0000 1.2 *************** *** 4,13 **** import EasyDialogs ! progressBar = EasyDialogs.ProgressBar('Testing py2exe', 100, 'Testing, testing, 1-2-3...') ! for i in range(100): ! time.sleep(0.001) ! progressBar.inc() ! ! print progressBar.curval ! sys.exit(progressBar.curval) --- 4,13 ---- import EasyDialogs + if __name__ == "__main__": + progressBar = EasyDialogs.ProgressBar('Testing py2exe', 100, 'Testing, testing, 1-2-3...') + for i in range(100): + time.sleep(0.001) + progressBar.inc() ! print progressBar.curval ! sys.exit(progressBar.curval) Index: test_noZipFile.py =================================================================== RCS file: /cvsroot/py2exe/py2exe/test/test_noZipFile.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_noZipFile.py 5 Apr 2008 11:48:10 -0000 1.1 --- test_noZipFile.py 17 Apr 2008 18:20:07 -0000 1.2 *************** *** 1 **** ! print 2+2 --- 1,2 ---- ! if __name__ == "__main__": ! print 2+2 --- NEW FILE: test_sys_path.py --- import sys if __name__ == "__main__": print 1 < len(sys.path) < 5 |