[Python-checkins] bpo-46099: Fix pthread_getcpuclockid test on Solaris (GH-30140) (GH-30183)
asvetlov
webhook-mailer at python.org
Sat Dec 18 08:49:09 EST 2021
https://github.com/python/cpython/commit/4f945ad7a510ad6dde13353784e45239edcdc14e
commit: 4f945ad7a510ad6dde13353784e45239edcdc14e
branch: 3.10
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: asvetlov <andrew.svetlov at gmail.com>
date: 2021-12-18T15:49:01+02:00
summary:
bpo-46099: Fix pthread_getcpuclockid test on Solaris (GH-30140) (GH-30183)
Co-authored-by: Andrew Svetlov <andrew.svetlov at gmail.com>
(cherry picked from commit 427a490c495cde8a152e938c6f02be65620e3e59)
Co-authored-by: Jakub Kulík <Kulikjak at gmail.com>
Co-authored-by: Jakub Kulík <Kulikjak at gmail.com>
files:
M Lib/test/test_time.py
diff --git a/Lib/test/test_time.py b/Lib/test/test_time.py
index 875615ad51007..d89078f08f611 100644
--- a/Lib/test/test_time.py
+++ b/Lib/test/test_time.py
@@ -113,12 +113,13 @@ def test_pthread_getcpuclockid(self):
clk_id = time.pthread_getcpuclockid(threading.get_ident())
self.assertTrue(type(clk_id) is int)
# 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:
+ if platform.system() == "AIX" and (sys.maxsize.bit_length() <= 32):
self.assertEqual(clk_id, time.CLOCK_THREAD_CPUTIME_ID)
+ # Solaris returns CLOCK_THREAD_CPUTIME_ID when current thread is given
+ elif sys.platform.startswith("sunos"):
+ self.assertEqual(clk_id, time.CLOCK_THREAD_CPUTIME_ID)
+ else:
+ self.assertNotEqual(clk_id, time.CLOCK_THREAD_CPUTIME_ID)
t1 = time.clock_gettime(clk_id)
t2 = time.clock_gettime(clk_id)
self.assertLessEqual(t1, t2)
More information about the Python-checkins
mailing list