Skip to content

Commit 2ddf725

Browse files
authored
Revert "bpo-27973 - Use test.support.temp_dir instead of NamedTemporaryFile for the (#17774)"
This reverts commit 5bba602.
1 parent 5bba602 commit 2ddf725

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,3 +1,4 @@
1+
import tempfile
12
import unittest
23
from test import test_support
34
from test.test_urllib2net import skip_ftp_test_on_travis
@@ -223,10 +224,9 @@ def test_multiple_ftp_retrieves(self):
223224

224225
with test_support.transient_internet(self.FTP_TEST_FILE):
225226
try:
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)))
227+
for _ in range(self.NUM_FTP_RETRIEVES):
228+
with tempfile.NamedTemporaryFile() as fp:
229+
urllib.FancyURLopener().retrieve(self.FTP_TEST_FILE, fp.name)
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)