diff options
author | Senthil Kumaran <senthil@uthcode.com> | 2020-01-04 02:14:18 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-04 02:14:18 (GMT) |
commit | 5bba60290b4ac8c95ac46cfdaba5deee37be1fab (patch) | |
tree | 8abff72ddcd3a45226f6f634746c9f095bdfc050 | |
parent | ecd572ae7abf22460296e0a306080d1f5209c73f (diff) | |
download | cpython-5bba60290b4ac8c95ac46cfdaba5deee37be1fab.zip cpython-5bba60290b4ac8c95ac46cfdaba5deee37be1fab.tar.gz cpython-5bba60290b4ac8c95ac46cfdaba5deee37be1fab.tar.bz2 |
bpo-27973 - Use test.support.temp_dir instead of NamedTemporaryFile for the (#17774)
desired behavior under windows platform.
Suggestion by David Bolen
-rw-r--r-- | Lib/test/test_urllibnet.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/test/test_urllibnet.py b/Lib/test/test_urllibnet.py index df118dc..ef33e3a 100644 --- a/Lib/test/test_urllibnet.py +++ b/Lib/test/test_urllibnet.py @@ -1,4 +1,3 @@ -import tempfile import unittest from test import test_support from test.test_urllib2net import skip_ftp_test_on_travis @@ -224,9 +223,10 @@ class urlopen_FTPTest(unittest.TestCase): 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) |