Merge "Wrap stdout object only once with wrap_stream"
This commit is contained in:
commit
a725ca89af
|
@ -350,12 +350,15 @@ class Builder(object):
|
|||
raise
|
||||
|
||||
if output:
|
||||
# ensure only wrapped once
|
||||
if hasattr(output, 'write'):
|
||||
output = utils.wrap_stream(output)
|
||||
|
||||
for job in self.parser.xml_jobs:
|
||||
if hasattr(output, 'write'):
|
||||
# `output` is a file-like object
|
||||
logger.info("Job name: %s", job.name)
|
||||
logger.debug("Writing XML to '{0}'".format(output))
|
||||
output = utils.wrap_stream(output)
|
||||
try:
|
||||
output.write(job.output())
|
||||
except IOError as exc:
|
||||
|
|
|
@ -95,7 +95,7 @@ class TestTests(CmdTestsBase):
|
|||
os.path.join(self.fixtures_path,
|
||||
'cmd-001.yaml'),
|
||||
'invalid'])
|
||||
args.output_dir = mock.MagicMock()
|
||||
args.output_dir = mock.MagicMock(wraps=io.BytesIO())
|
||||
cmd.execute(args, self.config) # probably better to fail here
|
||||
|
||||
def test_valid_job(self):
|
||||
|
|
Loading…
Reference in New Issue