Skip to content

Commit 2e0ecde

Browse files
authored
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 <[email protected]>
1 parent dd42cb7 commit 2e0ecde

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Lib/test/test_socket.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1618,7 +1618,7 @@ def test_socket_consistent_sock_type(self):
16181618
self.assertEqual(s.type, socket.SOCK_STREAM)
16191619

16201620
@unittest.skipIf(os.name == 'nt', 'Will not work on Windows')
1621-
def test_uknown_socket_family_repr(self):
1621+
def test_unknown_socket_family_repr(self):
16221622
# Test that when created with a family that's not one of the known
16231623
# AF_*/SOCK_* constants, socket.family just returns the number.
16241624
#
@@ -1642,7 +1642,8 @@ def test_uknown_socket_family_repr(self):
16421642
fileno=fd) as s:
16431643
self.assertEqual(s.family, unknown_family)
16441644
self.assertEqual(s.type, unknown_type)
1645-
self.assertEqual(s.proto, 23)
1645+
# some OS like macOS ignore proto
1646+
self.assertIn(s.proto, {0, 23})
16461647

16471648
@unittest.skipUnless(hasattr(os, 'sendfile'), 'test needs os.sendfile()')
16481649
def test__sendfile_use_sendfile(self):

0 commit comments

Comments
 (0)