mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
asyncio: Refactor tests: add a base TestCase class
This commit is contained in:
parent
d6f02fc649
commit
c73701de72
13 changed files with 145 additions and 219 deletions
|
@ -15,13 +15,13 @@ import asyncio
|
|||
from asyncio import test_utils
|
||||
|
||||
|
||||
class StreamReaderTests(unittest.TestCase):
|
||||
class StreamReaderTests(test_utils.TestCase):
|
||||
|
||||
DATA = b'line1\nline2\nline3\n'
|
||||
|
||||
def setUp(self):
|
||||
self.loop = asyncio.new_event_loop()
|
||||
asyncio.set_event_loop(None)
|
||||
self.set_event_loop(self.loop)
|
||||
|
||||
def tearDown(self):
|
||||
# just in case if we have transport close callbacks
|
||||
|
@ -29,6 +29,7 @@ class StreamReaderTests(unittest.TestCase):
|
|||
|
||||
self.loop.close()
|
||||
gc.collect()
|
||||
super().tearDown()
|
||||
|
||||
@mock.patch('asyncio.streams.events')
|
||||
def test_ctor_global_loop(self, m_events):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue