diff options
author | Walter Dörwald <walter@livinglogic.de> | 2009-05-01 17:35:37 (GMT) |
---|---|---|
committer | Walter Dörwald <walter@livinglogic.de> | 2009-05-01 17:35:37 (GMT) |
commit | 6733bed57e780008f8c78422d2a9676b9a2710cf (patch) | |
tree | 9ac7e1469b55cba61664a2b07e50566320a814d9 /Lib/test/test_gettext.py | |
parent | ca87fa5a5b650de2d4b5cb04fb5847cf631e75eb (diff) | |
download | cpython-6733bed57e780008f8c78422d2a9676b9a2710cf.zip cpython-6733bed57e780008f8c78422d2a9676b9a2710cf.tar.gz cpython-6733bed57e780008f8c78422d2a9676b9a2710cf.tar.bz2 |
Make test.test_support.EnvironmentVarGuard behave like a dictionary.
All changes are mirrored to the underlying os.environ dict, but rolled back
on exit from the with block.
Diffstat (limited to 'Lib/test/test_gettext.py')
-rw-r--r-- | Lib/test/test_gettext.py | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/Lib/test/test_gettext.py b/Lib/test/test_gettext.py index ab6bc9a..dca99cb 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 = test_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]) |