Replace platform test for darwin with support.MACOS · python/cpython@519fd6d · GitHub
Skip to content

Commit 519fd6d

Browse files
committed
Replace platform test for darwin with support.MACOS
1 parent 66ecefc commit 519fd6d

33 files changed

Lines changed: 63 additions & 62 deletions

Lib/test/_test_multiprocessing.py

Lines changed: 1 addition & 1 deletion

Lib/test/eintrdata/eintr_tester.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -348,12 +348,12 @@ def test_open(self):
348348
self._test_open("fp = open(path, 'r')\nfp.close()",
349349
self.python_open)
350350

351-
@unittest.skipIf(sys.platform == 'darwin', "hangs under OS X; see issue #25234")
351+
@unittest.skipIf(support.MACOS, "hangs under OS X; see issue #25234")
352352
def os_open(self, path):
353353
fd = os.open(path, os.O_WRONLY)
354354
os.close(fd)
355355

356-
@unittest.skipIf(sys.platform == "darwin", "hangs under OS X; see issue #25234")
356+
@unittest.skipIf(support.MACOS, "hangs under OS X; see issue #25234")
357357
def test_os_open(self):
358358
self._test_open("fd = os.open(path, os.O_RDONLY)\nos.close(fd)",
359359
self.os_open)
@@ -434,7 +434,7 @@ def test_select(self):
434434
self.stop_alarm()
435435
self.assertGreaterEqual(dt, self.sleep_time)
436436

437-
@unittest.skipIf(sys.platform == "darwin",
437+
@unittest.skipIf(support.MACOS,
438438
"poll may fail on macOS; see issue #28087")
439439
@unittest.skipUnless(hasattr(select, 'poll'), 'need select.poll')
440440
def test_poll(self):

Lib/test/libregrtest/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def setup_tests(ns):
6666
# fix is to set the stack limit to 2048.
6767
# This approach may also be useful for other Unixy platforms that
6868
# suffer from small default stack limits.
69-
if sys.platform == 'darwin':
69+
if support.MACOS:
7070
try:
7171
import resource
7272
except ImportError:

Lib/test/test__osx_support.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
import _osx_support
1414

15-
@unittest.skipUnless(sys.platform.startswith("darwin"), "requires OS X")
15+
@unittest.skipUnless(test.support.MACOS, "requires OS X")
1616
class Test_OSXSupport(unittest.TestCase):
1717

1818
def setUp(self):

Lib/test/test_asynchat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def __init__(self, terminator, server_port):
7777
def handle_connect(self):
7878
pass
7979

80-
if sys.platform == 'darwin':
80+
if support.MACOS:
8181
# select.poll returns a select.POLLHUP at the end of the tests
8282
# on darwin, so just ignore it
8383
def handle_expt(self):

Lib/test/test_asyncio/test_events.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def tearDownModule():
4343

4444
def osx_tiger():
4545
"""Return True if the platform is Mac OS 10.4 or older."""
46-
if sys.platform != 'darwin':
46+
if not support.MACOS:
4747
return False
4848
version = platform.mac_ver()[0]
4949
version = tuple(map(int, version.split('.')))

Lib/test/test_asyncore.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,7 @@ def test_handle_expt(self):
658658
if HAS_UNIX_SOCKETS and self.family == socket.AF_UNIX:
659659
self.skipTest("Not applicable to AF_UNIX sockets.")
660660

661-
if sys.platform == "darwin" and self.use_poll:
661+
if support.MACOS and self.use_poll:
662662
self.skipTest("poll may fail on macOS; see issue #28087")
663663

664664
class TestClient(BaseClient):

Lib/test/test_c_locale_coercion.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
# AIX uses iso8859-1 in the C locale, other *nix platforms use ASCII
4242
EXPECTED_C_LOCALE_STREAM_ENCODING = "iso8859-1"
4343
EXPECTED_C_LOCALE_FS_ENCODING = "iso8859-1"
44-
elif sys.platform == "darwin":
44+
elif test.support.MACOS:
4545
# FS encoding is UTF-8 on macOS
4646
EXPECTED_C_LOCALE_FS_ENCODING = "utf-8"
4747
elif sys.platform == "cygwin":
@@ -75,7 +75,7 @@
7575
# `locale.nl_langinfo(locale.CODESET)` works, as if it fails, the interpreter
7676
# will skip locale coercion for that particular target locale
7777
_check_nl_langinfo_CODESET = bool(
78-
sys.platform not in ("darwin", "linux") and
78+
(not test.support.MACOS) and sys.platform != "linux" and
7979
hasattr(locale, "nl_langinfo") and
8080
hasattr(locale, "CODESET")
8181
)

Lib/test/test_cmath.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from test.support import requires_IEEE_754, cpython_only
1+
from test.support import requires_IEEE_754, cpython_only, MACOS
22
from test.test_math import parse_testfile, test_file
33
import test.test_math as test_math
44
import unittest
@@ -339,7 +339,7 @@ def test_specific_values(self):
339339
SKIP_ON_TIGER = {'tan0064'}
340340

341341
osx_version = None
342-
if sys.platform == 'darwin':
342+
if MACOS:
343343
version_txt = platform.mac_ver()[0]
344344
try:
345345
osx_version = tuple(map(int, version_txt.split('.')))

Lib/test/test_cmd_line_script.py

Lines changed: 1 addition & 1 deletion

0 commit comments

Comments
 (0)