mirror of https://github.com/python/cpython
Move restoration of the os.environ object into the context manager where it belongs
This commit is contained in:
parent
87c03b3108
commit
fd4903bf05
|
@ -60,7 +60,6 @@ class BaseTestCase(unittest.TestCase):
|
||||||
self.lock.release()
|
self.lock.release()
|
||||||
self.thread.stop()
|
self.thread.stop()
|
||||||
os.environ.__exit__()
|
os.environ.__exit__()
|
||||||
os.environ = os.environ._environ
|
|
||||||
|
|
||||||
def request(self, uri, method='GET', body=None, headers={}):
|
def request(self, uri, method='GET', body=None, headers={}):
|
||||||
self.connection = httplib.HTTPConnection('localhost', self.PORT)
|
self.connection = httplib.HTTPConnection('localhost', self.PORT)
|
||||||
|
|
|
@ -576,6 +576,7 @@ class EnvironmentVarGuard(UserDict.DictMixin):
|
||||||
del self._environ[k]
|
del self._environ[k]
|
||||||
else:
|
else:
|
||||||
self._environ[k] = v
|
self._environ[k] = v
|
||||||
|
os.environ = self._environ
|
||||||
|
|
||||||
|
|
||||||
class DirsOnSysPath(object):
|
class DirsOnSysPath(object):
|
||||||
|
|
Loading…
Reference in New Issue