summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_asyncio/test_unix_events.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_asyncio/test_unix_events.py')
-rw-r--r--Lib/test/test_asyncio/test_unix_events.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/Lib/test/test_asyncio/test_unix_events.py b/Lib/test/test_asyncio/test_unix_events.py
index 4e2b76b..8646bf7 100644
--- a/Lib/test/test_asyncio/test_unix_events.py
+++ b/Lib/test/test_asyncio/test_unix_events.py
@@ -23,6 +23,7 @@ if sys.platform == 'win32':
import asyncio
from asyncio import log
from asyncio import base_events
+from asyncio import events
from asyncio import unix_events
from test.test_asyncio import utils as test_utils
@@ -517,7 +518,7 @@ class SelectorEventLoopUnixSockSendfileTests(test_utils.TestCase):
def test_sendfile_not_available(self):
sock, proto = self.prepare()
with mock.patch('asyncio.unix_events.os', spec=[]):
- with self.assertRaisesRegex(base_events._SendfileNotAvailable,
+ with self.assertRaisesRegex(events.SendfileNotAvailableError,
"os[.]sendfile[(][)] is not available"):
self.run_loop(self.loop._sock_sendfile_native(sock, self.file,
0, None))
@@ -526,7 +527,7 @@ class SelectorEventLoopUnixSockSendfileTests(test_utils.TestCase):
def test_sendfile_not_a_file(self):
sock, proto = self.prepare()
f = object()
- with self.assertRaisesRegex(base_events._SendfileNotAvailable,
+ with self.assertRaisesRegex(events.SendfileNotAvailableError,
"not a regular file"):
self.run_loop(self.loop._sock_sendfile_native(sock, f,
0, None))
@@ -535,7 +536,7 @@ class SelectorEventLoopUnixSockSendfileTests(test_utils.TestCase):
def test_sendfile_iobuffer(self):
sock, proto = self.prepare()
f = io.BytesIO()
- with self.assertRaisesRegex(base_events._SendfileNotAvailable,
+ with self.assertRaisesRegex(events.SendfileNotAvailableError,
"not a regular file"):
self.run_loop(self.loop._sock_sendfile_native(sock, f,
0, None))
@@ -545,7 +546,7 @@ class SelectorEventLoopUnixSockSendfileTests(test_utils.TestCase):
sock, proto = self.prepare()
f = mock.Mock()
f.fileno.return_value = -1
- with self.assertRaisesRegex(base_events._SendfileNotAvailable,
+ with self.assertRaisesRegex(events.SendfileNotAvailableError,
"not a regular file"):
self.run_loop(self.loop._sock_sendfile_native(sock, f,
0, None))
@@ -631,7 +632,7 @@ class SelectorEventLoopUnixSockSendfileTests(test_utils.TestCase):
with self.assertRaises(KeyError):
self.loop._selector.get_key(sock)
exc = fut.exception()
- self.assertIsInstance(exc, base_events._SendfileNotAvailable)
+ self.assertIsInstance(exc, events.SendfileNotAvailableError)
self.assertEqual(0, self.file.tell())
def test_os_error_next_call(self):
@@ -656,7 +657,7 @@ class SelectorEventLoopUnixSockSendfileTests(test_utils.TestCase):
fileno = self.file.fileno()
fut = self.loop.create_future()
- err = RuntimeError()
+ err = events.SendfileNotAvailableError()
with mock.patch('os.sendfile', side_effect=err):
self.loop._sock_sendfile_native_impl(fut, sock.fileno(),
sock, fileno,