mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
Issue #18792: Use "127.0.0.1" or "::1" instead of "localhost" as much as possible, since "localhost" goes through a DNS lookup under recent Windows versions.
This commit is contained in:
parent
13423c3726
commit
f6fbf56071
6 changed files with 24 additions and 14 deletions
|
@ -18,7 +18,7 @@ except ImportError:
|
|||
|
||||
from unittest import TestCase
|
||||
from test import support
|
||||
from test.support import HOST
|
||||
from test.support import HOST, HOSTv6
|
||||
threading = support.import_module('threading')
|
||||
|
||||
TIMEOUT = 3
|
||||
|
@ -767,7 +767,7 @@ class TestFTPClass(TestCase):
|
|||
class TestIPv6Environment(TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.server = DummyFTPServer(('::1', 0), af=socket.AF_INET6)
|
||||
self.server = DummyFTPServer((HOSTv6, 0), af=socket.AF_INET6)
|
||||
self.server.start()
|
||||
self.client = ftplib.FTP(timeout=TIMEOUT)
|
||||
self.client.connect(self.server.host, self.server.port)
|
||||
|
@ -950,7 +950,7 @@ class TestTimeouts(TestCase):
|
|||
self.assertTrue(socket.getdefaulttimeout() is None)
|
||||
socket.setdefaulttimeout(30)
|
||||
try:
|
||||
ftp = ftplib.FTP("localhost")
|
||||
ftp = ftplib.FTP(HOST)
|
||||
finally:
|
||||
socket.setdefaulttimeout(None)
|
||||
self.assertEqual(ftp.sock.gettimeout(), 30)
|
||||
|
@ -962,7 +962,7 @@ class TestTimeouts(TestCase):
|
|||
self.assertTrue(socket.getdefaulttimeout() is None)
|
||||
socket.setdefaulttimeout(30)
|
||||
try:
|
||||
ftp = ftplib.FTP("localhost", timeout=None)
|
||||
ftp = ftplib.FTP(HOST, timeout=None)
|
||||
finally:
|
||||
socket.setdefaulttimeout(None)
|
||||
self.assertTrue(ftp.sock.gettimeout() is None)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue