File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change
1
+ import tempfile
1
2
import unittest
2
3
from test import test_support
3
4
from test .test_urllib2net import skip_ftp_test_on_travis
@@ -223,10 +224,9 @@ def test_multiple_ftp_retrieves(self):
223
224
224
225
with test_support .transient_internet (self .FTP_TEST_FILE ):
225
226
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 )
230
230
except IOError as e :
231
231
self .fail ("Failed FTP retrieve while accessing ftp url "
232
232
"multiple times.\n Error message was : %s" % e )
You can’t perform that action at this time.
0 commit comments