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: Improve several exception handling practices in `test_descr.py`
Type: behavior Stage: resolved
Components: Tests Versions: Python 3.11, Python 3.10, Python 3.9
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: corona10, miss-islington, sobolevn
Priority: normal Keywords: patch

Created on 2022-01-07 22:38 by sobolevn, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 30471 merged sobolevn, 2022-01-07 22:40
PR 30475 merged corona10, 2022-01-08 04:06
PR 30476 merged miss-islington, 2022-01-08 04:14
PR 30477 merged miss-islington, 2022-01-08 04:15
Messages (5)
msg410050 - (view) Author: Nikita Sobolev (sobolevn) * (Python triager) Date: 2022-01-07 22:38
There are several problems in `test_descr.py` that I've found:
1. In `test_dir` there's a test case that ensure that `TypeError` is raised in some case: https://github.com/python/cpython/blame/c9dc1f491e8edb0bc433cde73190a3015d226891/Lib/test/test_descr.py#L2548-L2551 But it never does anything if this error is not raised. So, this test can contain a possible problem inside. It will just skip a scenario where `TypeError` is not thrown.

2. The same with `test_file_failt` here: https://github.com/python/cpython/blame/c9dc1f491e8edb0bc433cde73190a3015d226891/Lib/test/test_descr.py#L4451-L4456 If `RuntimeError` is not thrown - nothing happens

3. `assert 0, ...` is problematic: https://github.com/python/cpython/blame/c9dc1f491e8edb0bc433cde73190a3015d226891/Lib/test/test_descr.py#L4451-L4456 It can be dropped in optimized mode and it's error message is not ideal

I will send a PR with all these problems fixed.
msg410074 - (view) Author: Dong-hee Na (corona10) * (Python committer) Date: 2022-01-08 03:51
New changeset e63066cfed27511c9b786d61761f87f7a532571a by Nikita Sobolev in branch 'main':
bpo-46299: improve `test_descr.py` with stricter error handling (GH-30471)
https://github.com/python/cpython/commit/e63066cfed27511c9b786d61761f87f7a532571a
msg410076 - (view) Author: miss-islington (miss-islington) Date: 2022-01-08 05:26
New changeset 566d70a8d1c1afb8e770068f1686f762a1e343b9 by Miss Islington (bot) in branch '3.9':
bpo-46299: improve `test_descr.py` with stricter error handling (GH-30471)
https://github.com/python/cpython/commit/566d70a8d1c1afb8e770068f1686f762a1e343b9
msg410077 - (view) Author: miss-islington (miss-islington) Date: 2022-01-08 05:26
New changeset d2245cf190c36a6d74fe947bf133ce09d3313a6f by Miss Islington (bot) in branch '3.10':
bpo-46299: improve `test_descr.py` with stricter error handling (GH-30471)
https://github.com/python/cpython/commit/d2245cf190c36a6d74fe947bf133ce09d3313a6f
msg410080 - (view) Author: Dong-hee Na (corona10) * (Python committer) Date: 2022-01-08 08:14
New changeset 45d44b950f1dab0ef90d0a8f4fa75ffaae71500b by Dong-hee Na in branch 'main':
bpo-46299: Improve test_descr (GH-30475)
https://github.com/python/cpython/commit/45d44b950f1dab0ef90d0a8f4fa75ffaae71500b
History
Date User Action Args
2022-04-11 14:59:54adminsetgithub: 90457
2022-01-08 08:15:11corona10setstatus: open -> closed
stage: patch review -> resolved
2022-01-08 08:14:52corona10setmessages: + msg410080
2022-01-08 05:26:22miss-islingtonsetmessages: + msg410077
2022-01-08 05:26:22miss-islingtonsetmessages: + msg410076
2022-01-08 04:15:01miss-islingtonsetpull_requests: + pull_request28680
2022-01-08 04:14:56miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request28679
2022-01-08 04:06:53corona10setpull_requests: + pull_request28678
2022-01-08 03:51:54corona10setnosy: + corona10
messages: + msg410074
2022-01-07 22:40:50sobolevnsetkeywords: + patch
stage: patch review
pull_requests: + pull_request28674
2022-01-07 22:38:58sobolevncreate