Skip to content

Commit 5de85a1

Browse files
authored
bpo-29972: Skip tests known to fail on AIX (#979)
* bpo-29972: Fix test_eintr on AIX On AIX, sigtimedwait(0.2) sleeps 199.8 ms, whereas the test expects 200 ms or longer. * bpo-29972: Skip some inet_pton() tests on AIX Skip some inet_pton() tests of test_socket on AIX. inet_pton() on AIX is less strict than on Linux and doesn't reject some invalid IP addresses. The unit tests test more the libc than Python itself. * bpo-29972: Skip tests known to fail on AIX * test_locale.test_strcoll_with_diacritic() * test_locale.test_strxfrm_with_diacritic() * test_strptime.test_week_of_year_and_day_of_week_calculation() * test_tools.test_POT_Creation_Date()
1 parent 02e1213 commit 5de85a1

File tree

5 files changed

+23
-5
lines changed

5 files changed

+23
-5
lines changed

Lib/test/eintrdata/eintr_tester.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,12 @@ def test_sigtimedwait(self):
380380
t0 = time.monotonic()
381381
signal.sigtimedwait([signal.SIGUSR1], self.sleep_time)
382382
dt = time.monotonic() - t0
383-
self.assertGreaterEqual(dt, self.sleep_time)
383+
384+
if sys.platform.startswith('aix'):
385+
# On AIX, sigtimedwait(0.2) sleeps 199.8 ms
386+
self.assertGreaterEqual(dt, self.sleep_time * 0.9)
387+
else:
388+
self.assertGreaterEqual(dt, self.sleep_time)
384389

385390
@unittest.skipUnless(hasattr(signal, 'sigwaitinfo'),
386391
'need signal.sigwaitinfo()')

Lib/test/test_locale.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,9 +365,13 @@ def setUp(self):
365365
raise unittest.SkipTest('wcscoll/wcsxfrm have known bugs')
366366
BaseLocalizedTest.setUp(self)
367367

368+
@unittest.skipIf(sys.platform.startswith('aix'),
369+
'bpo-29972: broken test on AIX')
368370
def test_strcoll_with_diacritic(self):
369371
self.assertLess(locale.strcoll('à', 'b'), 0)
370372

373+
@unittest.skipIf(sys.platform.startswith('aix'),
374+
'bpo-29972: broken test on AIX')
371375
def test_strxfrm_with_diacritic(self):
372376
self.assertLess(locale.strxfrm('à'), locale.strxfrm('b'))
373377

Lib/test/test_socket.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,7 +1026,9 @@ def testIPv4toString(self):
10261026
self.assertEqual(b'\xaa\xaa\xaa\xaa', f('170.170.170.170'))
10271027
self.assertEqual(b'\x01\x02\x03\x04', f('1.2.3.4'))
10281028
self.assertEqual(b'\xff\xff\xff\xff', f('255.255.255.255'))
1029-
assertInvalid(f, '0.0.0.')
1029+
# bpo-29972: inet_pton() doesn't fail on AIX
1030+
if not sys.platform.startswith('aix'):
1031+
assertInvalid(f, '0.0.0.')
10301032
assertInvalid(f, '300.0.0.0')
10311033
assertInvalid(f, 'a.0.0.0')
10321034
assertInvalid(f, '1.2.3.4.5')
@@ -1081,10 +1083,12 @@ def testIPv6toString(self):
10811083
assertInvalid('::0::')
10821084
assertInvalid('1::abc::')
10831085
assertInvalid('1::abc::def')
1084-
assertInvalid('1:2:3:4:5:6:')
10851086
assertInvalid('1:2:3:4:5:6')
1086-
assertInvalid('1:2:3:4:5:6:7:8:')
10871087
assertInvalid('1:2:3:4:5:6:7:8:0')
1088+
# bpo-29972: inet_pton() doesn't fail on AIX
1089+
if not sys.platform.startswith('aix'):
1090+
assertInvalid('1:2:3:4:5:6:')
1091+
assertInvalid('1:2:3:4:5:6:7:8:')
10881092

10891093
self.assertEqual(b'\x00' * 12 + b'\xfe\x2a\x17\x40',
10901094
f('::254.42.23.64')

Lib/test/test_strptime.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import locale
66
import re
77
import os
8+
import sys
89
from test import support
910
from datetime import date as datetime_date
1011

@@ -482,6 +483,8 @@ def test_day_of_week_calculation(self):
482483
_ymd_excluded = ()
483484
_formats_excluded = ()
484485

486+
@unittest.skipIf(sys.platform.startswith('aix'),
487+
'bpo-29972: broken test on AIX')
485488
def test_week_of_year_and_day_of_week_calculation(self):
486489
# Should be able to infer date if given year, week of year (%U or %W)
487490
# and day of the week

Lib/test/test_tools/test_i18n.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Tests to cover the Tools/i18n package"""
22

33
import os
4+
import sys
45
import unittest
56

67
from test.support.script_helper import assert_python_ok
@@ -53,7 +54,8 @@ def test_header(self):
5354

5455
#"Plural-Forms" is optional
5556

56-
57+
@unittest.skipIf(sys.platform.startswith('aix'),
58+
'bpo-29972: broken test on AIX')
5759
def test_POT_Creation_Date(self):
5860
""" Match the date format from xgettext for POT-Creation-Date """
5961
from datetime import datetime

0 commit comments

Comments
 (0)