From cdab77259a5410fe4e89e90e2d83b316216d0e9b Mon Sep 17 00:00:00 2001 From: Roman Podolyaka Date: Thu, 28 Mar 2013 13:28:37 +0200 Subject: [PATCH] Ensure shell tests use isolated env variables set Fixes bug 1161008. Change-Id: Id9d76f39c898d4cff65aefa636e9dd2f092d42bd --- tests/test_shell.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/test_shell.py b/tests/test_shell.py index 7e71c5c92..433b220be 100644 --- a/tests/test_shell.py +++ b/tests/test_shell.py @@ -20,10 +20,8 @@ FAKE_ENV = {'OS_USERNAME': 'username', class ShellTest(utils.TestCase): def make_env(self, exclude=None): - for var, val in FAKE_ENV.items(): - if var == exclude: - continue - self.useFixture(fixtures.EnvironmentVariable(var, val)) + env = dict((k, v) for k, v in FAKE_ENV.items() if k != exclude) + self.useFixture(fixtures.MonkeyPatch('os.environ', env)) def setUp(self): super(ShellTest, self).setUp()