changeset 163:8198aa2ed20d

Some broken output validators on Win32 no longer get access-denied errors
author Oleg Oshmyan <chortos@inbox.lv>
date Fri, 10 Jun 2011 21:22:53 +0100
parents 5f9e6121161a
children b375daa74371
files upreckon/testcases.py
diffstat 1 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/upreckon/testcases.py	Wed Jun 08 20:53:26 2011 +0100
+++ b/upreckon/testcases.py	Fri Jun 10 21:22:53 2011 +0100
@@ -238,15 +238,15 @@
 				inputdatafname = case.problem.config.inname
 				contextmgr = Copying(case.infile, inputdatafname)
 			with contextmgr:
-				with open(inputdatafname) as infile:
-					with tempfile.TemporaryFile('w+') if options.erase and (not case.validator or callable(case.validator)) else open(case.problem.config.outname, 'w+') as outfile:
+				with tempfile.TemporaryFile('w+') if options.erase and (not case.validator or callable(case.validator)) else open(case.problem.config.outname, 'w+') as outfile:
+					with open(inputdatafname) as infile:
 						call(case.problem.config.path, case=case, stdin=infile, stdout=outfile, stderr=devnull)
-						if config.globalconf.force_zero_exitcode and case.process.returncode or case.process.returncode < 0:
-							raise NonZeroExitCode(case.process.returncode)
-						case.has_called_back = True
-						callback()
-						outfile.seek(0)
-						return case.validate(outfile)
+					if config.globalconf.force_zero_exitcode and case.process.returncode or case.process.returncode < 0:
+						raise NonZeroExitCode(case.process.returncode)
+					case.has_called_back = True
+					callback()
+					outfile.seek(0)
+					return case.validate(outfile)
 		else:
 			case.infile.copy(case.problem.config.inname)
 			call(case.problem.config.path, case=case, stdin=devnull, stdout=devnull, stderr=STDOUT)