mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +00:00
Fix urllib.request.build_opener mocking in test_distutils (should fix some random buildbot failures)
This commit is contained in:
commit
23b8cd963d
1 changed files with 2 additions and 0 deletions
|
@ -81,11 +81,13 @@ class RegisterTestCase(PyPIRCCommandTestCase):
|
|||
def _getpass(prompt):
|
||||
return 'password'
|
||||
getpass.getpass = _getpass
|
||||
urllib.request._opener = None
|
||||
self.old_opener = urllib.request.build_opener
|
||||
self.conn = urllib.request.build_opener = FakeOpener()
|
||||
|
||||
def tearDown(self):
|
||||
getpass.getpass = self._old_getpass
|
||||
urllib.request._opener = None
|
||||
urllib.request.build_opener = self.old_opener
|
||||
super(RegisterTestCase, self).tearDown()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue