Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

IsolatedAsyncioTestCase does not callasyncio.set_event_loop beforesetUp anymore,asyncio.Runner+PidFdChildWatcher leaves zombie processes #95736

Closed
Assignees
kumaraditya303
Labels
3.11only security fixes3.12only security fixestopic-asynciotype-bugAn unexpected behavior, bug, or error
@graingert

Description

@graingert

demo reproducer:

importunittestimportasyncioclassDemoTestCase1(unittest.IsolatedAsyncioTestCase):defsetUp(self):self.loop=asyncio.get_event_loop_policy().get_event_loop()asyncdeftest_demo(self):print("hello!")classDemoTestCase2(unittest.IsolatedAsyncioTestCase):defsetUp(self):self.loop=asyncio.get_event_loop_policy().get_event_loop()asyncdeftest_demo(self):print("hello!")if__name__=="__main__":unittest.main()

see also#93896

 graingert@conscientious  testing310  ~/projects  python3.10 foo.py hello!.hello!.----------------------------------------------------------------------Ran 2 tests in 0.002sOK
 graingert@conscientious  testing310  ~/projects  python3.11 foo.py hello!.E======================================================================ERROR: test_demo (__main__.DemoTestCase2.test_demo)----------------------------------------------------------------------Traceback (most recent call last):  File "/usr/lib/python3.11/unittest/async_case.py", line 82, in _callSetUp    self._asyncioTestContext.run(self.setUp)  File "/home/graingert/projects/foo.py", line 14, in setUp    self.loop = asyncio.get_event_loop_policy().get_event_loop()                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  File "/usr/lib/python3.11/asyncio/events.py", line 677, in get_event_loop    raise RuntimeError('There is no current event loop in thread %r.'RuntimeError: There is no current event loop in thread 'MainThread'.----------------------------------------------------------------------Ran 2 tests in 0.002sFAILED (errors=1)

it looks like this is becauseasyncio.Runner callsasyncio.set_event_loop( inRunner.run

Metadata

Metadata

Labels

3.11only security fixes3.12only security fixestopic-asynciotype-bugAn unexpected behavior, bug, or error

Projects

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp