changeset 103:4e6f231f055f

Fixed race condition resulting in calling back twice from TestCase.test
author Oleg Oshmyan <chortos@inbox.lv>
date Fri, 08 Apr 2011 17:56:54 +0300
parents 796eb7667fb0
children 8f46e84922f9
files testcases.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/testcases.py	Fri Apr 01 23:58:46 2011 +0300
+++ b/testcases.py	Fri Apr 08 17:56:54 2011 +0300
@@ -317,8 +317,8 @@
 						call(case.problem.config.path, case=case, stdin=infile, stdout=outfile, stderr=devnull, universal_newlines=True, bufsize=-1)
 						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()
-						case.has_called_back = True
 						outfile.seek(0)
 						return case.validate(outfile)
 		else:
@@ -326,8 +326,8 @@
 			call(case.problem.config.path, case=case, stdin=devnull, stdout=devnull, stderr=STDOUT)
 			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()
-			case.has_called_back = True
 			with open(case.problem.config.outname, 'rU') as output:
 				return case.validate(output)