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
This commit is contained in:
@@ -16,6 +16,9 @@
|
|||||||
|
|
||||||
import copy
|
import copy
|
||||||
import json
|
import json
|
||||||
|
import sys
|
||||||
|
|
||||||
|
from six import StringIO
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
|
|
||||||
@@ -153,6 +156,10 @@ class TestCLIActionExecutions(base.BaseCommandTest):
|
|||||||
def test_update_invalid_state(self):
|
def test_update_invalid_state(self):
|
||||||
states = ['PAUSED', 'WAITING', 'DELAYED']
|
states = ['PAUSED', 'WAITING', 'DELAYED']
|
||||||
|
|
||||||
|
# Redirect the stderr so it doesn't show during tox
|
||||||
|
_stderr = sys.stderr
|
||||||
|
sys.stderr = StringIO()
|
||||||
|
|
||||||
for state in states:
|
for state in states:
|
||||||
self.assertRaises(
|
self.assertRaises(
|
||||||
SystemExit,
|
SystemExit,
|
||||||
@@ -161,6 +168,10 @@ class TestCLIActionExecutions(base.BaseCommandTest):
|
|||||||
app_args=['id', '--state', state]
|
app_args=['id', '--state', state]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Stop the redirection
|
||||||
|
print(sys.stderr.getvalue())
|
||||||
|
sys.stderr = _stderr
|
||||||
|
|
||||||
def test_list(self):
|
def test_list(self):
|
||||||
self.client.action_executions.list.return_value = [ACTION_EX]
|
self.client.action_executions.list.return_value = [ACTION_EX]
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user