This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: `priority` in `sched.scheduler` is not sufficiently tested
Type: behavior Stage: patch review
Components: Tests Versions: Python 3.11
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: sobolevn
Priority: normal Keywords: patch

Created on 2022-02-05 15:50 by sobolevn, last changed 2022-04-11 14:59 by admin.

Pull Requests
URL Status Linked Edit
PR 31144 open sobolevn, 2022-02-05 15:51
Messages (1)
msg412577 - (view) Author: Nikita Sobolev (sobolevn) * (Python triager) Date: 2022-02-05 15:50
Right now there only a single test to ensure `priority` works correctly in `scheduler`: https://github.com/python/cpython/blob/fea7290a0ecee09bbce571d4d10f5881b7ea3485/Lib/test/test_sched.py#L90-L97

It looks like it is not enough. Why?

```
for priority in [1, 2, 3, 4, 5]:
  z = scheduler.enterabs(0.01, priority, fun, (priority,))
scheduler.run()
self.assertEqual(l, [1, 2, 3, 4, 5])
```

This test does not actually test different priorities. It only tests that a direct one works correctly. But, this might be a pure coincidence that numbers match. They are spawned in this particular order.

What if there are equal numbers? Like `[1, 2, 1]`

I propose adding more examples to this test. PR is on its way.
History
Date User Action Args
2022-04-11 14:59:55adminsetgithub: 90808
2022-02-05 15:51:16sobolevnsetkeywords: + patch
stage: patch review
pull_requests: + pull_request29322
2022-02-05 15:50:10sobolevncreate