changeset 19:d4fc9341664e 1.20.2

Fixed an exception when tests.zip contained test cases in its root
author Oleg Oshmyan <chortos@inbox.lv>
date Sun, 13 Jun 2010 12:46:49 +0000
parents a33653cdad57
children 5bfa23cd638d
files 1.20/test.py test-svn.py
diffstat 2 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/1.20/test.py	Mon Jun 07 23:42:16 2010 +0000
+++ b/1.20/test.py	Sun Jun 13 12:46:49 2010 +0000
@@ -3,7 +3,7 @@
 
 import os, sys, shutil, time, subprocess, filecmp, optparse, signal, tempfile, tarfile, zipfile
 
-parser = optparse.OptionParser(version='test.py 1.20.1', usage='usage: %prog [options] [problem names] [[path/to/]solution-app] [test case numbers]\n\nTest case numbers can be specified in plain text or as a Python expression\nif there is only one positional argument.\n\nOnly problem names listed in testconf.py are recognized.')
+parser = optparse.OptionParser(version='test.py 1.20.2', usage='usage: %prog [options] [problem names] [[path/to/]solution-app] [test case numbers]\n\nTest case numbers can be specified in plain text or as a Python expression\nif there is only one positional argument.\n\nOnly problem names listed in testconf.py are recognized.')
 parser.add_option('-e', '--exclude', dest='exclude', action='append', help='test case number(s) to exclude, as a Python expression; multiple -e options can be supplied')
 parser.add_option('-c', '--cleanup', dest='clean', action='store_true', default=False, help='delete the copies of input/output files and exit')
 parser.add_option('-s', '--save-io', dest='erase', action='store_false', default=True, help='do not delete the copies of input/output files after the last test case; create copies of input files and store output in files even if the solution uses standard I/O; delete the stored input/output files if the solution uses standard I/O and the -c/--cleanup option is specified')
@@ -283,8 +283,8 @@
 	if os.path.isfile('tests.zip'):
 		if not target.startswith('/'):
 			f = zipfile.ZipFile('tests.zip')
-			m = f.getinfo(name)
 			try:
+				m = f.getinfo(name)
 				m.filename = target
 				f.extract(m)
 				f.close()
@@ -896,4 +896,4 @@
 if options.pause:
 	print 'Press any key to exit... ',
 	sys.stdout.flush()
-	os.system(pause + ' >' + os.devnull)
\ No newline at end of file
+	os.system(pause + ' >' + os.devnull)
--- a/test-svn.py	Mon Jun 07 23:42:16 2010 +0000
+++ b/test-svn.py	Sun Jun 13 12:46:49 2010 +0000
@@ -342,8 +342,8 @@
 	if os.path.isfile('tests.zip'):
 		if not os.path.isabs(target):
 			f = zipfile.ZipFile('tests.zip')
-			m = f.getinfo(name)
 			try:
+				m = f.getinfo(name)
 				m.filename = target
 				f.extract(m)
 				f.close()
@@ -967,4 +967,4 @@
 if options.pause:
 	print 'Press any key to exit... ',
 	sys.stdout.flush()
-	os.system(pause + ' >' + os.devnull)
\ No newline at end of file
+	os.system(pause + ' >' + os.devnull)