diff options
author | Jakub KulĂk <Kulikjak@gmail.com> | 2021-12-18 13:26:24 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-18 13:26:24 (GMT) |
commit | 427a490c495cde8a152e938c6f02be65620e3e59 (patch) | |
tree | afa5d0b0a8a26aaa6aa4013897fb88f548cfd0d3 | |
parent | 6fc91daf730c60b08b4b32cdce28ff26505a0622 (diff) | |
download | cpython-427a490c495cde8a152e938c6f02be65620e3e59.zip cpython-427a490c495cde8a152e938c6f02be65620e3e59.tar.gz cpython-427a490c495cde8a152e938c6f02be65620e3e59.tar.bz2 |
bpo-46099: Fix pthread_getcpuclockid test on Solaris (GH-30140)
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
-rw-r--r-- | Lib/test/test_time.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/Lib/test/test_time.py b/Lib/test/test_time.py index f98aec2..1aa5874 100644 --- a/Lib/test/test_time.py +++ b/Lib/test/test_time.py @@ -117,12 +117,13 @@ class TimeTestCase(unittest.TestCase): 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) |