Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
gh-96021: Explicitly close the IsolatedAsyncioTestCase runner in tests
Tests for IsolatedAsyncioTestCase.debug() rely on the runner be closed
in __del__. It makes tests depending on the GC an unreliable on other
implementations. It is better to close the runner explicitly even if
currently there is no a public API for this.
  • Loading branch information
serhiy-storchaka committed Aug 20, 2022
commit f2af698d5aa3c3a1806385dad6c7a3bc9e2dc9d9
5 changes: 5 additions & 0 deletions Lib/test/test_unittest/test_async_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ async def on_cleanup(self):

events = []
test = Test("test_func")
self.addCleanup(test._tearDownAsyncioRunner)
try:
test.debug()
except MyException:
Expand Down Expand Up @@ -186,6 +187,7 @@ async def on_cleanup(self):

events = []
test = Test("test_func")
self.addCleanup(test._tearDownAsyncioRunner)
try:
test.debug()
except MyException:
Expand Down Expand Up @@ -221,6 +223,7 @@ async def on_cleanup(self):

events = []
test = Test("test_func")
self.addCleanup(test._tearDownAsyncioRunner)
try:
test.debug()
except MyException:
Expand Down Expand Up @@ -262,6 +265,7 @@ async def on_cleanup2(self):

events = []
test = Test("test_func")
self.addCleanup(test._tearDownAsyncioRunner)
try:
test.debug()
except MyException:
Expand Down Expand Up @@ -424,6 +428,7 @@ async def cleanup(self, fut):

events = []
test = Test("test_func")
self.addCleanup(test._tearDownAsyncioRunner)
try:
test.debug()
except MyException:
Expand Down