comparison upreckon/testcases.py @ 206:4edb6ef5a676

'Incorrect' is now stripped from external validator output
author Oleg Oshmyan <chortos@inbox.lv>
date Wed, 17 Aug 2011 21:03:28 +0300
parents 166a23999bf7
children ede78fbd509a
comparison
equal deleted inserted replaced
205:166a23999bf7 206:4edb6ef5a676
226 case.process = Popen(case.validator, stdin=devnull, stdout=PIPE, stderr=STDOUT, universal_newlines=True, bufsize=-1) 226 case.process = Popen(case.validator, stdin=devnull, stdout=PIPE, stderr=STDOUT, universal_newlines=True, bufsize=-1)
227 except OSError: 227 except OSError:
228 raise CannotStartValidator(sys.exc_info()[1]) 228 raise CannotStartValidator(sys.exc_info()[1])
229 with signal_ignorer: 229 with signal_ignorer:
230 comment = case.process.communicate()[0].strip() 230 comment = case.process.communicate()[0].strip()
231 match = re.match(r'(?i)(ok|(?:correct|wrong)(?:(?:\s|_)*answer)?)(?:$|\s+|[.,!:]+\s*)', comment) 231 match = re.match(r'(?i)(?:ok|(?:(?:in)?correct|wrong)(?:(?:\s|_)*answer)?)(?:$|\s+|[.,!:]+\s*)', comment)
232 if match: 232 if match:
233 comment = comment[match.end():] 233 comment = comment[match.end():]
234 if not case.problem.config.maxexitcode: 234 if not case.problem.config.maxexitcode:
235 if case.process.returncode: 235 if case.process.returncode:
236 raise WrongAnswer(comment) 236 raise WrongAnswer(comment)