Mercurial > ~astiob > upreckon > hgweb
comparison upreckon/testcases.py @ 160:93bf6b333c99 2.01
Some broken output validators on Win32 no longer get access-denied errors
author | Oleg Oshmyan <chortos@inbox.lv> |
---|---|
date | Fri, 10 Jun 2011 21:22:53 +0100 |
parents | d5b6708c1955 |
children | e0b2fbd7ebe0 aed52e3fa5a0 |
comparison
equal
deleted
inserted
replaced
159:8f02b97f8073 | 160:93bf6b333c99 |
---|---|
236 contextmgr = CopyDeleting(case, case.infile, inputdatafname) | 236 contextmgr = CopyDeleting(case, case.infile, inputdatafname) |
237 else: | 237 else: |
238 inputdatafname = case.problem.config.inname | 238 inputdatafname = case.problem.config.inname |
239 contextmgr = Copying(case.infile, inputdatafname) | 239 contextmgr = Copying(case.infile, inputdatafname) |
240 with contextmgr: | 240 with contextmgr: |
241 with open(inputdatafname) as infile: | 241 with tempfile.TemporaryFile('w+') if options.erase and (not case.validator or callable(case.validator)) else open(case.problem.config.outname, 'w+') as outfile: |
242 with tempfile.TemporaryFile('w+') if options.erase and (not case.validator or callable(case.validator)) else open(case.problem.config.outname, 'w+') as outfile: | 242 with open(inputdatafname) as infile: |
243 call(case.problem.config.path, case=case, stdin=infile, stdout=outfile, stderr=devnull) | 243 call(case.problem.config.path, case=case, stdin=infile, stdout=outfile, stderr=devnull) |
244 if config.globalconf.force_zero_exitcode and case.process.returncode or case.process.returncode < 0: | 244 if config.globalconf.force_zero_exitcode and case.process.returncode or case.process.returncode < 0: |
245 raise NonZeroExitCode(case.process.returncode) | 245 raise NonZeroExitCode(case.process.returncode) |
246 case.has_called_back = True | 246 case.has_called_back = True |
247 callback() | 247 callback() |
248 outfile.seek(0) | 248 outfile.seek(0) |
249 return case.validate(outfile) | 249 return case.validate(outfile) |
250 else: | 250 else: |
251 case.infile.copy(case.problem.config.inname) | 251 case.infile.copy(case.problem.config.inname) |
252 call(case.problem.config.path, case=case, stdin=devnull, stdout=devnull, stderr=STDOUT) | 252 call(case.problem.config.path, case=case, stdin=devnull, stdout=devnull, stderr=STDOUT) |
253 if config.globalconf.force_zero_exitcode and case.process.returncode or case.process.returncode < 0: | 253 if config.globalconf.force_zero_exitcode and case.process.returncode or case.process.returncode < 0: |
254 raise NonZeroExitCode(case.process.returncode) | 254 raise NonZeroExitCode(case.process.returncode) |