[Python-checkins] bpo-28134: Ignore proto in unknown socket test (GH-5435)

Christian Heimes webhook-mailer at python.org
Tue Jan 30 02:55:49 EST 2018


https://github.com/python/cpython/commit/2e0ecde8d74f5fc0e3e3e39216975cc70efc4796
commit: 2e0ecde8d74f5fc0e3e3e39216975cc70efc4796
branch: master
author: Christian Heimes <christian at python.org>
committer: GitHub <noreply at github.com>
date: 2018-01-30T08:55:46+01:00
summary:

bpo-28134: Ignore proto in unknown socket test (GH-5435)

Band-aid for macOS: Some platforms seem to ignore unknown protocols.

Signed-off-by: Christian Heimes <christian at python.org>

files:
M Lib/test/test_socket.py

diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py
index 89cf1fa52009..2851922bd0c5 100644
--- a/Lib/test/test_socket.py
+++ b/Lib/test/test_socket.py
@@ -1618,7 +1618,7 @@ def test_socket_consistent_sock_type(self):
             self.assertEqual(s.type, socket.SOCK_STREAM)
 
     @unittest.skipIf(os.name == 'nt', 'Will not work on Windows')
-    def test_uknown_socket_family_repr(self):
+    def test_unknown_socket_family_repr(self):
         # Test that when created with a family that's not one of the known
         # AF_*/SOCK_* constants, socket.family just returns the number.
         #
@@ -1642,7 +1642,8 @@ def test_uknown_socket_family_repr(self):
                 fileno=fd) as s:
             self.assertEqual(s.family, unknown_family)
             self.assertEqual(s.type, unknown_type)
-            self.assertEqual(s.proto, 23)
+            # some OS like macOS ignore proto
+            self.assertIn(s.proto, {0, 23})
 
     @unittest.skipUnless(hasattr(os, 'sendfile'), 'test needs os.sendfile()')
     def test__sendfile_use_sendfile(self):



More information about the Python-checkins mailing list