comparison testcases.py @ 110:6d6d2c82e776 2.00

Absent output files no longer crash Upreckon
author Oleg Oshmyan <chortos@inbox.lv>
date Fri, 08 Apr 2011 17:45:53 +0300
parents dcabc9eb2fde
children f0b63838f407
comparison
equal deleted inserted replaced
109:dcabc9eb2fde 110:6d6d2c82e776
326 call(case.problem.config.path, case=case, stdin=devnull, stdout=devnull, stderr=STDOUT) 326 call(case.problem.config.path, case=case, stdin=devnull, stdout=devnull, stderr=STDOUT)
327 if config.globalconf.force_zero_exitcode and case.process.returncode or case.process.returncode < 0: 327 if config.globalconf.force_zero_exitcode and case.process.returncode or case.process.returncode < 0:
328 raise NonZeroExitCode(case.process.returncode) 328 raise NonZeroExitCode(case.process.returncode)
329 case.has_called_back = True 329 case.has_called_back = True
330 callback() 330 callback()
331 with open(case.problem.config.outname, 'rU') as output: 331 try:
332 output = open(case.problem.config.outname, 'rU')
333 except IOError:
334 raise CannotReadOutputFile(sys.exc_info()[1])
335 with output as output:
332 return case.validate(output) 336 return case.validate(output)
333 337
334 338
335 # This is the only test case type not executing any programs to be tested 339 # This is the only test case type not executing any programs to be tested
336 class OutputOnlyTestCase(ValidatedTestCase): 340 class OutputOnlyTestCase(ValidatedTestCase):