classification
Title: Fix debug() in IsolatedAsyncioTestCase
Type: behavior Stage: resolved
Components: asyncio, Library (Lib) Versions: Python 3.11, Python 3.10, Python 3.9
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: asvetlov, ezio.melotti, lukasz.langa, michael.foord, rbcollins, serhiy.storchaka, yselivanov
Priority: normal Keywords: patch

Created on 2021-09-18 13:54 by serhiy.storchaka, last changed 2021-09-22 16:57 by lukasz.langa. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 28449 merged serhiy.storchaka, 2021-09-18 14:00
PR 28521 merged lukasz.langa, 2021-09-22 16:10
PR 28522 merged lukasz.langa, 2021-09-22 16:19
Messages (6)
msg402132 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2021-09-18 13:54
Currently debug() does not work in IsolatedAsyncioTestCase subclasses. It runs synchronous code (setUp(), tearDown(), synchronous tests and cleanup functions), but does not run any asynchronous code (asyncSetUp(), asyncTearDown(), asynchronous tests and cleanup functions) and produces warnings "RuntimeWarning: coroutine 'xxx' was never awaited".
msg402149 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2021-09-19 10:03
It turned out be more complicated than I expected. We need to keep the even loop after getting exception in debug() for having ability to run doCleanup() etc. The option is to close the even loop in __del__. But we should ensure that it is closed before running other event loop. Also, assertRaises() creates reference loops, so we cannot use it.
msg402446 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2021-09-22 15:43
New changeset ecb6922ff2d56476a6cfb0941ae55aca5e7fae3d by Serhiy Storchaka in branch 'main':
bpo-45238: Fix unittest.IsolatedAsyncioTestCase.debug() (GH-28449)
https://github.com/python/cpython/commit/ecb6922ff2d56476a6cfb0941ae55aca5e7fae3d
msg402454 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2021-09-22 16:42
New changeset 44396aaba9b92b3a38a4b422a000d1a8eb05185a by Łukasz Langa in branch '3.10':
[3.10] bpo-45238: Fix unittest.IsolatedAsyncioTestCase.debug() (GH-28449) (GH-28521)
https://github.com/python/cpython/commit/44396aaba9b92b3a38a4b422a000d1a8eb05185a
msg402455 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2021-09-22 16:48
New changeset e06b0fddf69b933fe82f60d78a0f6248ca36a0a3 by Łukasz Langa in branch '3.9':
[3.9] bpo-45238: Fix unittest.IsolatedAsyncioTestCase.debug() (GH-28449) (GH-28522)
https://github.com/python/cpython/commit/e06b0fddf69b933fe82f60d78a0f6248ca36a0a3
msg402456 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2021-09-22 16:57
Thanks, Serhiy! ✨ 🍰 ✨
History
Date User Action Args
2021-09-22 16:57:42lukasz.langasetstatus: open -> closed
resolution: fixed
messages: + msg402456

stage: patch review -> resolved
2021-09-22 16:48:40lukasz.langasetmessages: + msg402455
2021-09-22 16:42:23lukasz.langasetmessages: + msg402454
2021-09-22 16:19:28lukasz.langasetpull_requests: + pull_request26913
2021-09-22 16:10:49lukasz.langasetpull_requests: + pull_request26912
2021-09-22 15:43:30lukasz.langasetnosy: + lukasz.langa
messages: + msg402446
2021-09-19 10:03:01serhiy.storchakasetmessages: + msg402149
2021-09-18 14:00:18serhiy.storchakasetkeywords: + patch
stage: patch review
pull_requests: + pull_request26852
2021-09-18 13:54:37serhiy.storchakacreate