Cleaning up http_proxy on http tests
Gustavo Niemeyer
gustavo at niemeyer.net
Fri Oct 7 01:53:02 BST 2005
The attached patch will cleanup the http_proxy environment
variable during the setup of the local HTTP server for local
tests. Currently, it may show errors like the one below due
to the proxy.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/niemeyer/src/bzr.mergelog2/bzrlib/selftest/testfetch.py", line 138, in test_weaves_are_retrieved_once
len([log for log in self.weblogs if log.endswith(weave_suffix)]))
AssertionError: 1 != 0
--
Gustavo Niemeyer
http://niemeyer.net
-------------- next part --------------
=== modified file 'bzrlib/selftest/HTTPTestUtil.py'
--- bzrlib/selftest/HTTPTestUtil.py
+++ bzrlib/selftest/HTTPTestUtil.py
@@ -137,9 +137,15 @@
self._http_thread = threading.Thread(target=self._http_start)
self._http_thread.setDaemon(True)
self._http_thread.start()
+ self._http_proxy = os.environ.get("http_proxy")
+ if self._http_proxy is not None:
+ del os.environ["http_proxy"]
def tearDown(self):
self._http_running = False
self._http_thread.join()
+ if self._http_proxy is not None:
+ import os
+ os.environ["http_proxy"] = self._http_proxy
TestCaseInTempDir.tearDown(self)
More information about the bazaar
mailing list