From 8298675d5af88daa0a58810340815b17cd5ed414 Mon Sep 17 00:00:00 2001 From: Adriano Petrich Date: Fri, 21 Jul 2017 10:45:25 +0100 Subject: [PATCH] Give better tox output One of the tests would output stderr and it would not be captured by tox resulting in output like this http://paste.openstack.org/show/616128/ The tests are working fine but that output gives a false impression to the developer that something is wrong I captured the stderr during that test so that would not show. Change-Id: I7f76da0cb1a57280848d7d831e2a686e4ec5c81a --- mistralclient/tests/unit/v2/test_cli_action_execs.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/mistralclient/tests/unit/v2/test_cli_action_execs.py b/mistralclient/tests/unit/v2/test_cli_action_execs.py index 9f6e5257..49db348d 100644 --- a/mistralclient/tests/unit/v2/test_cli_action_execs.py +++ b/mistralclient/tests/unit/v2/test_cli_action_execs.py @@ -16,6 +16,9 @@ import copy import json +import sys + +from six import StringIO import mock @@ -153,6 +156,10 @@ class TestCLIActionExecutions(base.BaseCommandTest): def test_update_invalid_state(self): states = ['PAUSED', 'WAITING', 'DELAYED'] + # Redirect the stderr so it doesn't show during tox + _stderr = sys.stderr + sys.stderr = StringIO() + for state in states: self.assertRaises( SystemExit, @@ -161,6 +168,10 @@ class TestCLIActionExecutions(base.BaseCommandTest): app_args=['id', '--state', state] ) + # Stop the redirection + print(sys.stderr.getvalue()) + sys.stderr = _stderr + def test_list(self): self.client.action_executions.list.return_value = [ACTION_EX]