Skip to content

[2.7] bpo-27973 - urlretrive fails on second ftp transfer. #17774

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 4, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Lib/test/test_urllibnet.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import tempfile
import unittest
from test import test_support
from test.test_urllib2net import skip_ftp_test_on_travis
Expand Down Expand Up @@ -224,9 +223,10 @@ def test_multiple_ftp_retrieves(self):

with test_support.transient_internet(self.FTP_TEST_FILE):
try:
for _ in range(self.NUM_FTP_RETRIEVES):
with tempfile.NamedTemporaryFile() as fp:
urllib.FancyURLopener().retrieve(self.FTP_TEST_FILE, fp.name)
for file_num in range(self.NUM_FTP_RETRIEVES):
with test_support.temp_dir() as td:
urllib.FancyURLopener().retrieve(self.FTP_TEST_FILE,
os.path.join(td, str(file_num)))
except IOError as e:
self.fail("Failed FTP retrieve while accessing ftp url "
"multiple times.\n Error message was : %s" % e)
Expand Down