Mercurial > ~astiob > upreckon > hgweb
comparison upreckon/testcases.py @ 200:fa81289ee407
force_zero_exitcode is now a problem-specific configuration variable
author | Oleg Oshmyan <chortos@inbox.lv> |
---|---|
date | Wed, 17 Aug 2011 00:32:01 +0300 |
parents | 760d38ee86d6 |
children | 00c80bba7f13 |
comparison
equal
deleted
inserted
replaced
199:1de2ea435d93 | 200:fa81289ee407 |
---|---|
266 contextmgr = Copying(case.infile, inputdatafname) | 266 contextmgr = Copying(case.infile, inputdatafname) |
267 with contextmgr: | 267 with contextmgr: |
268 with tempfile.TemporaryFile('w+b') if options.erase and (not case.validator or callable(case.validator)) else open(case.problem.config.outname, 'w+b') as outfile: | 268 with tempfile.TemporaryFile('w+b') if options.erase and (not case.validator or callable(case.validator)) else open(case.problem.config.outname, 'w+b') as outfile: |
269 with open(inputdatafname) as infile: | 269 with open(inputdatafname) as infile: |
270 call(case.problem.config.path, case=case, stdin=infile, stdout=outfile, stderr=devnull) | 270 call(case.problem.config.path, case=case, stdin=infile, stdout=outfile, stderr=devnull) |
271 if config.globalconf.force_zero_exitcode and case.process.returncode or case.process.returncode < 0: | 271 if case.problem.config.force_zero_exitcode and case.process.returncode or case.process.returncode < 0: |
272 raise NonZeroExitCode(case.process.returncode) | 272 raise NonZeroExitCode(case.process.returncode) |
273 case.has_called_back = True | 273 case.has_called_back = True |
274 callback() | 274 callback() |
275 outfile.seek(0) | 275 outfile.seek(0) |
276 return case.validate(outfile) | 276 return case.validate(outfile) |
277 else: | 277 else: |
278 case.infile.copy(case.problem.config.inname) | 278 case.infile.copy(case.problem.config.inname) |
279 call(case.problem.config.path, case=case, stdin=devnull, stdout=devnull, stderr=devnull) | 279 call(case.problem.config.path, case=case, stdin=devnull, stdout=devnull, stderr=devnull) |
280 if config.globalconf.force_zero_exitcode and case.process.returncode or case.process.returncode < 0: | 280 if case.problem.config.force_zero_exitcode and case.process.returncode or case.process.returncode < 0: |
281 raise NonZeroExitCode(case.process.returncode) | 281 raise NonZeroExitCode(case.process.returncode) |
282 case.has_called_back = True | 282 case.has_called_back = True |
283 callback() | 283 callback() |
284 try: | 284 try: |
285 output = open(case.problem.config.outname, 'rb') | 285 output = open(case.problem.config.outname, 'rb') |