mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
Merged revisions 72167 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r72167 | walter.doerwald | 2009-05-01 19:35:37 +0200 (Fr, 01 Mai 2009) | 5 lines 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. ........
This commit is contained in:
parent
33841c3489
commit
155374d95d
10 changed files with 79 additions and 68 deletions
|
@ -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])
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue