diff options
| author | Malcolm Smith <smith@chaquo.com> | 2024-03-11 19:25:39 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-11 19:25:39 (GMT) |
| commit | 872c0714fcdc168ce4a69bdd0346f2d5dd488ec2 (patch) | |
| tree | 84934c17e5561cc36d337d83b436fcc5bb40fd88 /Lib/test/test_socket.py | |
| parent | 9f983e00ec55b87a098a4c8229fe5bb9acb9f3ac (diff) | |
| download | cpython-872c0714fcdc168ce4a69bdd0346f2d5dd488ec2.zip cpython-872c0714fcdc168ce4a69bdd0346f2d5dd488ec2.tar.gz cpython-872c0714fcdc168ce4a69bdd0346f2d5dd488ec2.tar.bz2 | |
gh-71052: Change Android's `sys.platform` from "linux" to "android"
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Diffstat (limited to 'Lib/test/test_socket.py')
| -rw-r--r-- | Lib/test/test_socket.py | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py index b936e9a..a7e657f 100644 --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py @@ -1199,8 +1199,8 @@ class GeneralModuleTests(unittest.TestCase): # I've ordered this by protocols that have both a tcp and udp # protocol, at least for modern Linuxes. if ( - sys.platform.startswith(('freebsd', 'netbsd', 'gnukfreebsd')) - or sys.platform == 'linux' + sys.platform.startswith( + ('linux', 'android', 'freebsd', 'netbsd', 'gnukfreebsd')) or is_apple ): # avoid the 'echo' service on this platform, as there is an @@ -1218,8 +1218,7 @@ class GeneralModuleTests(unittest.TestCase): raise OSError # Try same call with optional protocol omitted # Issue #26936: Android getservbyname() was broken before API 23. - if (not hasattr(sys, 'getandroidapilevel') or - sys.getandroidapilevel() >= 23): + if (not support.is_android) or sys.getandroidapilevel() >= 23: port2 = socket.getservbyname(service) eq(port, port2) # Try udp, but don't barf if it doesn't exist @@ -1577,8 +1576,7 @@ class GeneralModuleTests(unittest.TestCase): # port can be a string service name such as "http", a numeric # port number or None # Issue #26936: Android getaddrinfo() was broken before API level 23. - if (not hasattr(sys, 'getandroidapilevel') or - sys.getandroidapilevel() >= 23): + if (not support.is_android) or sys.getandroidapilevel() >= 23: socket.getaddrinfo(HOST, "http") socket.getaddrinfo(HOST, 80) socket.getaddrinfo(HOST, None) @@ -3196,7 +3194,7 @@ class SendmsgStreamTests(SendmsgTests): # Linux supports MSG_DONTWAIT when sending, but in general, it # only works when receiving. Could add other platforms if they # support it too. - @skipWithClientIf(sys.platform not in {"linux"}, + @skipWithClientIf(sys.platform not in {"linux", "android"}, "MSG_DONTWAIT not known to work on this platform when " "sending") def testSendmsgDontWait(self): @@ -5634,7 +5632,7 @@ class TestExceptions(unittest.TestCase): sock.setblocking(False) -@unittest.skipUnless(sys.platform == 'linux', 'Linux specific test') +@unittest.skipUnless(sys.platform in ('linux', 'android'), 'Linux specific test') class TestLinuxAbstractNamespace(unittest.TestCase): UNIX_PATH_MAX = 108 @@ -5759,7 +5757,8 @@ class TestUnixDomain(unittest.TestCase): self.addCleanup(os_helper.unlink, path) self.assertEqual(self.sock.getsockname(), path) - @unittest.skipIf(sys.platform == 'linux', 'Linux specific test') + @unittest.skipIf(sys.platform in ('linux', 'android'), + 'Linux behavior is tested by TestLinuxAbstractNamespace') def testEmptyAddress(self): # Test that binding empty address fails. self.assertRaises(OSError, self.sock.bind, "") |
