Issue 31479: Always reset the signal alarm in tests (original) (raw)

Created on 2017-09-14 21:33 by vstinner, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 3588 merged vstinner,2017-09-14 21:34
PR 7312 merged vstinner,2018-06-01 11:50
PR 7314 merged vstinner,2018-06-01 12:08

| Repositories containing patches | | | | | ------------------------------------------------------------------------------------------------------------------------------------ | | | | | <Misc/NEWS.d/next/Library/2017-09-13-19-55-35.bpo-31544Misc/NEWS.d/next/Library/2017-09-13-19-55-35.bpo-31544.beTh6t.rst.beTh6t.rst> | | | |

Messages (7)
msg302213 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-09-14 21:33
While fixing bpo-17085 on Python 2.7 (test_socket: cancel scheduled alarm on test failure), I noticed that not all unit tests currently always reset the signal alarm. I propose to always use the pattern "try/finally: signal.alarm(0)" to make sure that a test doesn't "leak" a pending fatal signal alarm. Attached PR fixes the issue. I don't think that it's worth it to backport the fix, since it only impacts tests which fail, interrupted manually by CTRL+c or other corner cases.
msg302223 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-09-14 22:59
Maybe add a context manager? Some pattern is repeated multiple times.
msg302543 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-09-19 16:36
New changeset 9abee722d448c1c00c7d4e11ce242ec7b13e5c49 by Victor Stinner in branch 'master': bpo-31479: Always reset the signal alarm in tests (#3588) https://github.com/python/cpython/commit/9abee722d448c1c00c7d4e11ce242ec7b13e5c49
msg302545 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-09-19 16:40
While the fix is nice to have to handle corner cases, I'm not sure that it's really useful to backport the change to Python 2.7 and 3.6. So I close the issue.
msg302546 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-09-19 16:40
Serhiy: "Maybe add a context manager? Some pattern is repeated multiple times." As I wrote on the PR, I'm not sure because not all the code look the same. Please propose a PR if you want, I can review it!
msg318412 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-06-01 13:23
New changeset 3604b2390a8986117c35d661d3d3a5977dfe8260 by Victor Stinner in branch '2.7': bpo-31479: Always reset the signal alarm in tests (GH-3588) (GH-7314) https://github.com/python/cpython/commit/3604b2390a8986117c35d661d3d3a5977dfe8260
msg318413 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-06-01 13:23
New changeset 95681c7a7ddd436ba7d6c10d1202c33dd6bd648b by Victor Stinner in branch '3.6': bpo-31479: Always reset the signal alarm in tests (GH-3588) (GH-7312) https://github.com/python/cpython/commit/95681c7a7ddd436ba7d6c10d1202c33dd6bd648b
History
Date User Action Args
2022-04-11 14:58:52 admin set github: 75660
2018-06-01 13:23:12 vstinner set messages: +
2018-06-01 13:23:04 vstinner set messages: +
2018-06-01 12:08:32 vstinner set pull_requests: + <pull%5Frequest6944>
2018-06-01 11:50:51 vstinner set pull_requests: + <pull%5Frequest6943>
2017-09-19 16:40:46 vstinner set status: open -> closedresolution: fixedmessages: + stage: patch review -> resolved
2017-09-19 16:40:14 vstinner set messages: +
2017-09-19 16:36:56 vstinner set messages: +
2017-09-14 22:59:57 serhiy.storchaka set hgrepos: + hgrepo373messages: +
2017-09-14 21:35:33 vstinner set title: Always reset the signal alarm in tets -> Always reset the signal alarm in tests
2017-09-14 21:35:30 vstinner set title: Always reset the signal alarm on unit tests -> Always reset the signal alarm in tets
2017-09-14 21:34:55 vstinner set keywords: + patchstage: patch reviewpull_requests: + <pull%5Frequest3579>
2017-09-14 21:34:50 vstinner set nosy: + serhiy.storchaka
2017-09-14 21:33:50 vstinner create