Mercurial > ~astiob > upreckon > hgweb
changeset 105:9f922b11c98a
Absent output files no longer crash Upreckon
author | Oleg Oshmyan <chortos@inbox.lv> |
---|---|
date | Fri, 08 Apr 2011 17:45:53 +0300 |
parents | 8f46e84922f9 |
children | aa0378ea1f93 |
files | testcases.py |
diffstat | 1 files changed, 10 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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)