mirror of
https://github.com/python/cpython.git
synced 2025-08-01 15:43:13 +00:00
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
ca87fa5a5b
commit
6733bed57e
11 changed files with 72 additions and 67 deletions
|
@ -605,7 +605,7 @@ class CGIHandlerTestCase(unittest.TestCase):
|
|||
|
||||
def test_cgi_get(self):
|
||||
with test_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
|
||||
|
@ -646,7 +646,7 @@ class CGIHandlerTestCase(unittest.TestCase):
|
|||
sys.stdout = open(test_support.TESTFN, "w")
|
||||
|
||||
with test_support.EnvironmentVarGuard() as env:
|
||||
env.set('CONTENT_LENGTH', str(len(data)))
|
||||
env['CONTENT_LENGTH'] = str(len(data))
|
||||
self.cgi.handle_request()
|
||||
|
||||
sys.stdin.close()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue