diff options
author | Noorul Islam K M <noorul@noorul.com> | 2013-11-13 19:18:51 +0530 |
---|---|---|
committer | Noorul Islam K M <noorul@noorul.com> | 2013-11-13 19:18:51 +0530 |
commit | 3fc0f46fa96615c59cce044e3e58e502923edae4 (patch) | |
tree | 55e197a569176f30d7cf03b2f18fa90491bc32c2 | |
parent | f7cd3f8b745fb939e3dcd1de9a0f85f2cfbd26a6 (diff) | |
download | oslotest-3fc0f46fa96615c59cce044e3e58e502923edae4.tar.gz |
Use cleaner version from cookiecutter OpenStack template
In one of the review comments [1], russellb said that the code in
cookiecutter OpenStack template is more cleaner. So incorporate that
logic here.
[1] https://review.openstack.org/#/c/55111
Change-Id: I1a298bc6a2429f591b062bbfa3b0ce7122268cc5
-rw-r--r-- | openstack/common/test.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/openstack/common/test.py b/openstack/common/test.py index 3350599..f3537e9 100644 --- a/openstack/common/test.py +++ b/openstack/common/test.py @@ -22,6 +22,8 @@ import os import fixtures import testtools +_TRUE_VALUES = ('True', 'true', '1', 'yes') + class BaseTestCase(testtools.TestCase): @@ -44,11 +46,9 @@ class BaseTestCase(testtools.TestCase): self.useFixture(fixtures.Timeout(test_timeout, gentle=True)) def _fake_output(self): - if (os.environ.get('OS_STDOUT_CAPTURE') == 'True' or - os.environ.get('OS_STDOUT_CAPTURE') == '1'): + if os.environ.get('OS_STDOUT_CAPTURE') in _TRUE_VALUES: stdout = self.useFixture(fixtures.StringStream('stdout')).stream self.useFixture(fixtures.MonkeyPatch('sys.stdout', stdout)) - if (os.environ.get('OS_STDERR_CAPTURE') == 'True' or - os.environ.get('OS_STDERR_CAPTURE') == '1'): + if os.environ.get('OS_STDERR_CAPTURE') in _TRUE_VALUES: stderr = self.useFixture(fixtures.StringStream('stderr')).stream self.useFixture(fixtures.MonkeyPatch('sys.stderr', stderr)) |