mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
asyncio: Replace "unittest.mock" with "mock" in unit tests
Use "from unittest import mock". It should simplify my work to merge new tests in Trollius, because Trollius uses "mock" backport for Python 2.
This commit is contained in:
parent
71ec82a501
commit
24ba203504
12 changed files with 368 additions and 368 deletions
|
@ -4,7 +4,7 @@ import functools
|
|||
import gc
|
||||
import socket
|
||||
import unittest
|
||||
import unittest.mock
|
||||
from unittest import mock
|
||||
try:
|
||||
import ssl
|
||||
except ImportError:
|
||||
|
@ -29,7 +29,7 @@ class StreamReaderTests(unittest.TestCase):
|
|||
self.loop.close()
|
||||
gc.collect()
|
||||
|
||||
@unittest.mock.patch('asyncio.streams.events')
|
||||
@mock.patch('asyncio.streams.events')
|
||||
def test_ctor_global_loop(self, m_events):
|
||||
stream = asyncio.StreamReader()
|
||||
self.assertIs(stream._loop, m_events.get_event_loop.return_value)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue