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:
Adriano Petrich 2017-07-21 10:45:25 +01:00
parent d94b82b3bc
commit 8298675d5a
1 changed files with 11 additions and 0 deletions

View File

@ -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]