# HG changeset patch # User Oleg Oshmyan # Date 1302273953 -10800 # Node ID 9f922b11c98a550516ef22515a4ed333738ec7ed # Parent 8f46e84922f93cafe482688ceef35bd5dad0cc5f Absent output files no longer crash Upreckon diff -r 8f46e84922f9 -r 9f922b11c98a testcases.py --- a/testcases.py Fri Apr 08 17:42:30 2011 +0300 +++ b/testcases.py Fri Apr 08 17:45:53 2011 +0300 @@ -331,7 +331,11 @@ raise NonZeroExitCode(case.process.returncode) case.has_called_back = True callback() - with open(case.problem.config.outname, 'rU') as output: + try: + output = open(case.problem.config.outname, 'rU') + except IOError: + raise CannotReadOutputFile(sys.exc_info()[1]) + with output as output: return case.validate(output) @@ -347,7 +351,11 @@ case.time_stopped = case.time_started = 0 case.has_called_back = True callback() - with open(case.problem.config.outname.replace('$', case.id), 'rU') as output: + try: + output = open(case.problem.config.outname.replace('$', case.id), 'rU') + except IOError: + raise CannotReadOutputFile(sys.exc_info()[1]) + with output as output: return case.validate(output)