changeset 57:855bdfeb32a6

NameErrors within call() are now reported
author Oleg Oshmyan <chortos@inbox.lv>
date Tue, 21 Dec 2010 02:28:57 +0200
parents 693a938bdeee
children c95addbe0851
files testcases.py
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/testcases.py	Tue Dec 21 02:24:18 2010 +0200
+++ b/testcases.py	Tue Dec 21 02:28:57 2010 +0200
@@ -101,6 +101,7 @@
 	else:
 		# TODO: implement Win32 call()
 		pass
+	call = None
 else:
 	# Make SIGCHLD interrupt sleep() and select()
 	def bury_child(signum, frame):
@@ -445,9 +446,9 @@
 				# FIXME: this U doesn't do anything good for the child process, does it?
 				with open(inputdatafname, 'rU') as infile:
 					with tempfile.TemporaryFile('w+') if options.erase and not case.validator else open(case.problem.config.outname, 'w+') as outfile:
-						try:
+						if call is not None:
 							call(case.problem.config.path, case=case, stdin=infile, stdout=outfile, stderr=devnull, universal_newlines=True, bufsize=-1, preexec_fn=preexec_fn)
-						except NameError:
+						else:
 							try:
 								try:
 									case.process = Popen(case.problem.config.path, stdin=infile, stdout=outfile, stderr=devnull, universal_newlines=True, bufsize=-1, preexec_fn=preexec_fn)
@@ -499,9 +500,9 @@
 						return case.validate(outfile)
 		else:
 			case.infile.copy(case.problem.config.inname)
-			try:
+			if call is not None:
 				call(case.problem.config.path, case=case, stdin=devnull, stdout=devnull, stderr=STDOUT, preexec_fn=preexec_fn)
-			except NameError:
+			else:
 				try:
 					try:
 						case.process = Popen(case.problem.config.path, stdin=devnull, stdout=devnull, stderr=STDOUT, preexec_fn=preexec_fn)