summaryrefslogtreecommitdiff
path: root/Lib/test/test_gettext.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_gettext.py')
-rw-r--r--Lib/test/test_gettext.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/Lib/test/test_gettext.py b/Lib/test/test_gettext.py
index 6ee608e32c..e26b30a899 100644
--- a/Lib/test/test_gettext.py
+++ b/Lib/test/test_gettext.py
@@ -58,10 +58,6 @@ LOCALEDIR = os.path.join('xx', 'LC_MESSAGES')
MOFILE = os.path.join(LOCALEDIR, 'gettext.mo')
UMOFILE = os.path.join(LOCALEDIR, 'ugettext.mo')
MMOFILE = os.path.join(LOCALEDIR, 'metadata.mo')
-try:
- LANG = os.environ['LANGUAGE']
-except:
- LANG = 'en'
class GettextBaseTest(unittest.TestCase):
@@ -77,10 +73,12 @@ class GettextBaseTest(unittest.TestCase):
fp = open(MMOFILE, 'wb')
fp.write(base64.decodestring(MMO_DATA))
fp.close()
- os.environ['LANGUAGE'] = 'xx'
+ self.env = support.EnvironmentVarGuard()
+ self.env['LANGUAGE'] = 'xx'
def tearDown(self):
- os.environ['LANGUAGE'] = LANG
+ self.env.__exit__()
+ del self.env
shutil.rmtree(os.path.split(LOCALEDIR)[0])