summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorMichael Felt <aixtools@users.noreply.github.com>2018-12-28 13:57:37 (GMT)
committerNick Coghlan <ncoghlan@gmail.com>2018-12-28 13:57:37 (GMT)
commite2926b72488596f59e43c27f3b7cedf0c5b9e88e (patch)
treedc8a3af47e822ffc6573726decb9c8dd75e6af7a /Lib/test
parentc465682718f15cd3deb6b37db5fb607718ac64ed (diff)
downloadcpython-e2926b72488596f59e43c27f3b7cedf0c5b9e88e.zip
cpython-e2926b72488596f59e43c27f3b7cedf0c5b9e88e.tar.gz
cpython-e2926b72488596f59e43c27f3b7cedf0c5b9e88e.tar.bz2
bpo-34373: fix test_mktime and test_pthread_getcpuclickid tests on AIX (GH-8726)
* Fix test_mktime on AIX by adding code to get mktime to behave the same way as it does on other *nix systems * Fix test_pthread_getcpuclickid in AIX by adjusting the test case expectations when running on AIX in 32-bit mode Patch by Michael Felt.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_time.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/Lib/test/test_time.py b/Lib/test/test_time.py
index 2f0665a..136ad29 100644
--- a/Lib/test/test_time.py
+++ b/Lib/test/test_time.py
@@ -119,7 +119,13 @@ class TimeTestCase(unittest.TestCase):
def test_pthread_getcpuclockid(self):
clk_id = time.pthread_getcpuclockid(threading.get_ident())
self.assertTrue(type(clk_id) is int)
- self.assertNotEqual(clk_id, time.CLOCK_THREAD_CPUTIME_ID)
+ # when in 32-bit mode AIX only returns the predefined constant
+ if not platform.system() == "AIX":
+ self.assertNotEqual(clk_id, time.CLOCK_THREAD_CPUTIME_ID)
+ elif (sys.maxsize.bit_length() > 32):
+ self.assertNotEqual(clk_id, time.CLOCK_THREAD_CPUTIME_ID)
+ else:
+ self.assertEqual(clk_id, time.CLOCK_THREAD_CPUTIME_ID)
t1 = time.clock_gettime(clk_id)
t2 = time.clock_gettime(clk_id)
self.assertLessEqual(t1, t2)
@@ -424,13 +430,6 @@ class TimeTestCase(unittest.TestCase):
def test_mktime(self):
# Issue #1726687
for t in (-2, -1, 0, 1):
- if sys.platform.startswith('aix') and t == -1:
- # Issue #11188, #19748: mktime() returns -1 on error. On Linux,
- # the tm_wday field is used as a sentinel () to detect if -1 is
- # really an error or a valid timestamp. On AIX, tm_wday is
- # unchanged even on success and so cannot be used as a
- # sentinel.
- continue
try:
tt = time.localtime(t)
except (OverflowError, OSError):