[Python-checkins] bpo-46530: add `"thread_time"` to `test_time.test_get_clock_info` (GH-30913)

miss-islington webhook-mailer at python.org
Fri Jan 28 11:56:37 EST 2022


https://github.com/python/cpython/commit/ce5c637f5ae06f2a6a6e966524af9d0cc816bd3f
commit: ce5c637f5ae06f2a6a6e966524af9d0cc816bd3f
branch: 3.9
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2022-01-28T08:56:26-08:00
summary:

bpo-46530: add `"thread_time"` to `test_time.test_get_clock_info` (GH-30913)

(cherry picked from commit c27a33132be101e246ae2584f1826477357138d6)

Co-authored-by: Nikita Sobolev <mail at sobolevn.me>

files:
M Lib/test/test_time.py

diff --git a/Lib/test/test_time.py b/Lib/test/test_time.py
index be9fb5ad5f0b1..008ba2833a7d7 100644
--- a/Lib/test/test_time.py
+++ b/Lib/test/test_time.py
@@ -544,20 +544,26 @@ def test_localtime_failure(self):
         self.assertRaises(ValueError, time.ctime, float("nan"))
 
     def test_get_clock_info(self):
-        clocks = ['monotonic', 'perf_counter', 'process_time', 'time']
+        clocks = [
+            'monotonic',
+            'perf_counter',
+            'process_time',
+            'time',
+            'thread_time',
+        ]
 
         for name in clocks:
-            info = time.get_clock_info(name)
-
-            #self.assertIsInstance(info, dict)
-            self.assertIsInstance(info.implementation, str)
-            self.assertNotEqual(info.implementation, '')
-            self.assertIsInstance(info.monotonic, bool)
-            self.assertIsInstance(info.resolution, float)
-            # 0.0 < resolution <= 1.0
-            self.assertGreater(info.resolution, 0.0)
-            self.assertLessEqual(info.resolution, 1.0)
-            self.assertIsInstance(info.adjustable, bool)
+            with self.subTest(name=name):
+                info = time.get_clock_info(name)
+
+                self.assertIsInstance(info.implementation, str)
+                self.assertNotEqual(info.implementation, '')
+                self.assertIsInstance(info.monotonic, bool)
+                self.assertIsInstance(info.resolution, float)
+                # 0.0 < resolution <= 1.0
+                self.assertGreater(info.resolution, 0.0)
+                self.assertLessEqual(info.resolution, 1.0)
+                self.assertIsInstance(info.adjustable, bool)
 
         self.assertRaises(ValueError, time.get_clock_info, 'xxx')
 



More information about the Python-checkins mailing list