summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_socket.py
diff options
context:
space:
mode:
authorChristian Heimes <christian@python.org>2022-07-31 16:19:32 (GMT)
committerGitHub <noreply@github.com>2022-07-31 16:19:32 (GMT)
commit06b5f78d64763dfd05aa0cc8b3419de9e9c2ab50 (patch)
tree0960b96f1829b2d87267616dafc19f77223e9a32 /Lib/test/test_socket.py
parent147a9a8be79fb5666e264175e3047d6d67b50254 (diff)
downloadcpython-06b5f78d64763dfd05aa0cc8b3419de9e9c2ab50.zip
cpython-06b5f78d64763dfd05aa0cc8b3419de9e9c2ab50.tar.gz
cpython-06b5f78d64763dfd05aa0cc8b3419de9e9c2ab50.tar.bz2
[3.11] gh-95174: WASI: skip missing sockets functions (GH-95179) (GH-95308)
Co-authored-by: Christian Heimes <christian@python.org> Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
Diffstat (limited to 'Lib/test/test_socket.py')
-rw-r--r--Lib/test/test_socket.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py
index a2938cd..72e3394 100644
--- a/Lib/test/test_socket.py
+++ b/Lib/test/test_socket.py
@@ -956,6 +956,19 @@ class GeneralModuleTests(unittest.TestCase):
socket.IPPROTO_L2TP
socket.IPPROTO_SCTP
+ @unittest.skipIf(support.is_wasi, "WASI is missing these methods")
+ def test_socket_methods(self):
+ # socket methods that depend on a configure HAVE_ check. They should
+ # be present on all platforms except WASI.
+ names = [
+ "_accept", "bind", "connect", "connect_ex", "getpeername",
+ "getsockname", "listen", "recvfrom", "recvfrom_into", "sendto",
+ "setsockopt", "shutdown"
+ ]
+ for name in names:
+ if not hasattr(socket.socket, name):
+ self.fail(f"socket method {name} is missing")
+
@unittest.skipUnless(sys.platform == 'darwin', 'macOS specific test')
@unittest.skipUnless(socket_helper.IPV6_ENABLED, 'IPv6 required for this test')
def test3542SocketOptions(self):