gh-109015: Add test.support.socket_helper.tcp_blackhole() (#109016)

Skip test_asyncio, test_imaplib and test_socket tests if FreeBSD TCP
blackhole is enabled (net.inet.tcp.blackhole=2).
This commit is contained in:
Victor Stinner 2023-09-07 01:58:03 +02:00 committed by GitHub
parent 60a9eea3f5
commit a52a350977
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 79 additions and 0 deletions

View file

@ -5288,6 +5288,7 @@ class NetworkConnectionNoServer(unittest.TestCase):
finally:
socket.socket = old_socket
@socket_helper.skip_if_tcp_blackhole
def test_connect(self):
port = socket_helper.find_unused_port()
cli = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
@ -5296,6 +5297,7 @@ class NetworkConnectionNoServer(unittest.TestCase):
cli.connect((HOST, port))
self.assertEqual(cm.exception.errno, errno.ECONNREFUSED)
@socket_helper.skip_if_tcp_blackhole
def test_create_connection(self):
# Issue #9792: errors raised by create_connection() should have
# a proper errno attribute.