classification
Title: Always reset the signal alarm in tests
Type: Stage: resolved
Components: Tests Versions: Python 3.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: serhiy.storchaka, vstinner
Priority: normal Keywords: patch

Created on 2017-09-14 21:33 by vstinner, last changed 2018-06-01 13:23 by vstinner. 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
2018-06-01 13:23:12vstinnersetmessages: + msg318413
2018-06-01 13:23:04vstinnersetmessages: + msg318412
2018-06-01 12:08:32vstinnersetpull_requests: + pull_request6944
2018-06-01 11:50:51vstinnersetpull_requests: + pull_request6943
2017-09-19 16:40:46vstinnersetstatus: open -> closed
resolution: fixed
messages: + msg302546

stage: patch review -> resolved
2017-09-19 16:40:14vstinnersetmessages: + msg302545
2017-09-19 16:36:56vstinnersetmessages: + msg302543
2017-09-14 22:59:57serhiy.storchakasethgrepos: + hgrepo373
messages: + msg302223
2017-09-14 21:35:33vstinnersettitle: Always reset the signal alarm in tets -> Always reset the signal alarm in tests
2017-09-14 21:35:30vstinnersettitle: Always reset the signal alarm on unit tests -> Always reset the signal alarm in tets
2017-09-14 21:34:55vstinnersetkeywords: + patch
stage: patch review
pull_requests: + pull_request3579
2017-09-14 21:34:50vstinnersetnosy: + serhiy.storchaka
2017-09-14 21:33:50vstinnercreate