changeset 109:dcabc9eb2fde 2.00

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 b92333120c67
children 6d6d2c82e776
files testcases.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/testcases.py	Wed Mar 09 16:51:20 2011 +0000
+++ 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)