From 3fe85e5bbded98d03cb1c6ea18a73ce6ebef783f Mon Sep 17 00:00:00 2001 From: Darragh Bailey Date: Wed, 7 Mar 2018 14:14:38 +0000 Subject: [PATCH] Capture XML output from test Running a test with input yaml will result in output XML being sent to the stdout. Use mock on the console to capture this so that running the tests via testtools directly doesn't output unnecessarily Change-Id: I4ccbfcb464d40a77c04913cb8281a0167504e1a4 --- tests/cmd/subcommands/test_test.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/cmd/subcommands/test_test.py b/tests/cmd/subcommands/test_test.py index 11c7679c9..ac1c1e0bf 100644 --- a/tests/cmd/subcommands/test_test.py +++ b/tests/cmd/subcommands/test_test.py @@ -58,7 +58,9 @@ class TestTests(CmdTestsBase): os.path.join(self.fixtures_path, 'cmd-001.yaml'), 'foo-job'] - self.execute_jenkins_jobs_with_args(args) + console_out = io.BytesIO() + with mock.patch('sys.stdout', console_out): + self.execute_jenkins_jobs_with_args(args) def test_console_output(self): """