mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
gh-71052: Change Android's sys.platform
from "linux" to "android"
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
This commit is contained in:
parent
9f983e00ec
commit
872c0714fc
24 changed files with 97 additions and 81 deletions
|
@ -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, "")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue