comparison 2.00/testcases.py @ 41:164395af969d

Cosmetical edit subprocess.Popen always accepts TemporaryFile instances due to their implementation.
author Oleg Oshmyan <chortos@inbox.lv>
date Sun, 05 Dec 2010 15:00:27 +0100
parents 2b459f9743b4
children 81f58c938ec5
comparison
equal deleted inserted replaced
40:af9c45708987 41:164395af969d
364 contextmgr = Copying(case.infile, inputdatafname) 364 contextmgr = Copying(case.infile, inputdatafname)
365 with contextmgr: 365 with contextmgr:
366 # FIXME: this U doesn't do anything good for the child process, does it? 366 # FIXME: this U doesn't do anything good for the child process, does it?
367 with open(inputdatafname, 'rU') as infile: 367 with open(inputdatafname, 'rU') as infile:
368 with tempfile.TemporaryFile('w+') if options.erase and not case.validator else open(case.problem.config.outname, 'w+') as outfile: 368 with tempfile.TemporaryFile('w+') if options.erase and not case.validator else open(case.problem.config.outname, 'w+') as outfile:
369 # TODO: make sure outfile.file is passed to Popen if needed
370 try: 369 try:
371 try: 370 try:
372 case.process = Popen(case.problem.config.path, stdin=infile, stdout=outfile, stderr=devnull, universal_newlines=True, bufsize=-1, preexec_fn=preexec_fn) 371 case.process = Popen(case.problem.config.path, stdin=infile, stdout=outfile, stderr=devnull, universal_newlines=True, bufsize=-1, preexec_fn=preexec_fn)
373 except MemoryError: 372 except MemoryError:
374 # If there is not enough memory for the forked test.py, 373 # If there is not enough memory for the forked test.py,