Commit b651949f authored by Antoine Pitrou's avatar Antoine Pitrou

test_urllibnet: make it so that transient_internet() applies to the

whole HTTP exchange, not only the opening.
parent 8d9a4628
......@@ -43,7 +43,9 @@ class urlopenNetworkTests(unittest.TestCase):
def urlopen(self, *args, **kwargs):
resource = args[0]
with support.transient_internet(resource):
cm = support.transient_internet(resource)
cm.__enter__()
self.addCleanup(cm.__exit__, None, None, None)
return urllib.request.urlopen(*args, **kwargs)
def test_basic(self):
......@@ -135,7 +137,9 @@ class urlretrieveNetworkTests(unittest.TestCase):
def urlretrieve(self, *args):
resource = args[0]
with support.transient_internet(resource):
cm = support.transient_internet(resource)
cm.__enter__()
self.addCleanup(cm.__exit__, None, None, None)
return urllib.request.urlretrieve(*args)
def test_basic(self):
......
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