Commit 17a7b819 authored by Antoine Pitrou's avatar Antoine Pitrou

Fix urllib.request.build_opener mocking in test_distutils (should fix some...

Fix urllib.request.build_opener mocking in test_distutils (should fix some random buildbot failures)
parent c2c0846c
...@@ -81,11 +81,13 @@ class RegisterTestCase(PyPIRCCommandTestCase): ...@@ -81,11 +81,13 @@ class RegisterTestCase(PyPIRCCommandTestCase):
def _getpass(prompt): def _getpass(prompt):
return 'password' return 'password'
getpass.getpass = _getpass getpass.getpass = _getpass
urllib.request._opener = None
self.old_opener = urllib.request.build_opener self.old_opener = urllib.request.build_opener
self.conn = urllib.request.build_opener = FakeOpener() self.conn = urllib.request.build_opener = FakeOpener()
def tearDown(self): def tearDown(self):
getpass.getpass = self._old_getpass getpass.getpass = self._old_getpass
urllib.request._opener = None
urllib.request.build_opener = self.old_opener urllib.request.build_opener = self.old_opener
super(RegisterTestCase, self).tearDown() super(RegisterTestCase, self).tearDown()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment