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:
Walter Dörwald 2009-05-01 19:58:58 +00:00
parent 33841c3489
commit 155374d95d
10 changed files with 79 additions and 68 deletions

View file

@ -572,7 +572,7 @@ class CGIHandlerTestCase(unittest.TestCase):
def test_cgi_get(self):
with support.EnvironmentVarGuard() as env:
env.set('REQUEST_METHOD', 'GET')
env['REQUEST_METHOD'] = 'GET'
# if the method is GET and no request_text is given, it runs handle_get
# get sysout output
tmp = sys.stdout
@ -613,7 +613,7 @@ class CGIHandlerTestCase(unittest.TestCase):
sys.stdout = open(support.TESTFN, "w")
with support.EnvironmentVarGuard() as env:
env.set('CONTENT_LENGTH', str(len(data)))
env['CONTENT_LENGTH'] = str(len(data))
self.cgi.handle_request()
sys.stdin.close()