Skip to content

Commit 5bba602

Browse files
authored
bpo-27973 - Use test.support.temp_dir instead of NamedTemporaryFile for the (python#17774)
desired behavior under windows platform. Suggestion by David Bolen
1 parent ecd572a commit 5bba602

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Lib/test/test_urllibnet.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import tempfile
21
import unittest
32
from test import test_support
43
from test.test_urllib2net import skip_ftp_test_on_travis
@@ -224,9 +223,10 @@ def test_multiple_ftp_retrieves(self):
224223

225224
with test_support.transient_internet(self.FTP_TEST_FILE):
226225
try:
227-
for _ in range(self.NUM_FTP_RETRIEVES):
228-
with tempfile.NamedTemporaryFile() as fp:
229-
urllib.FancyURLopener().retrieve(self.FTP_TEST_FILE, fp.name)
226+
for file_num in range(self.NUM_FTP_RETRIEVES):
227+
with test_support.temp_dir() as td:
228+
urllib.FancyURLopener().retrieve(self.FTP_TEST_FILE,
229+
os.path.join(td, str(file_num)))
230230
except IOError as e:
231231
self.fail("Failed FTP retrieve while accessing ftp url "
232232
"multiple times.\n Error message was : %s" % e)

0 commit comments

Comments
 (0)