[New-bugs-announce] [issue46530] `'thread_time'` is missing from `test_get_clock_info`

Nikita Sobolev report at bugs.python.org
Wed Jan 26 04:02:03 EST 2022


New submission from Nikita Sobolev <mail at sobolevn.me>:

Right now here's how `test_get_clock_info` looks like:

```
def test_get_clock_info(self):
        clocks = ['monotonic', 'perf_counter', 'process_time', '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)
```

It tests for out of five possible arguments to `time.get_clock_info`.
Docs: https://docs.python.org/3/library/time.html#time.get_clock_info
`'thread_time'` is missing for some reason.

I think we should add it to the test.

Link: https://github.com/python/cpython/blob/7cf285d82ec722d4225297366013e924805171f2/Lib/test/test_time.py#L559

PR is incoming.

----------
components: Tests
messages: 411717
nosy: sobolevn
priority: normal
severity: normal
status: open
title: `'thread_time'` is missing from `test_get_clock_info`
type: behavior
versions: Python 3.10, Python 3.11, Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46530>
_______________________________________


More information about the New-bugs-announce mailing list