Skip to content

Commit

Permalink
Merge "Fix unit tests failing when OS_ env vars are set"
Browse files Browse the repository at this point in the history
  • Loading branch information
Jenkins authored and openstack-gerrit committed Sep 26, 2014
2 parents d721871 + b13c84b commit 08c111e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions tests/unit/test_shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,14 +435,15 @@ class TestParsing(unittest.TestCase):

def setUp(self):
super(TestParsing, self).setUp()
self._orig_environ = os.environ.copy()
self._environ_vars = {}
keys = os.environ.keys()
for k in keys:
if k in ('ST_KEY', 'ST_USER', 'ST_AUTH'):
del os.environ[k]
if (k in ('ST_KEY', 'ST_USER', 'ST_AUTH')
or k.startswith('OS_')):
self._environ_vars[k] = os.environ.pop(k)

def tearDown(self):
os.environ = self._orig_environ
os.environ.update(self._environ_vars)

def _make_fake_command(self, result):
def fake_command(parser, args, thread_manager):
Expand Down

0 comments on commit 08c111e

Please sign in to comment.