mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
asyncio, Tulip issue 139: Improve error messages on "fatal errors"
Mention if the error was caused by a read or a write, and be more specific on the object (ex: "pipe transport" instead of "transport").
This commit is contained in:
parent
c098241342
commit
065ca25aae
6 changed files with 64 additions and 38 deletions
|
@ -69,7 +69,9 @@ class ProactorSocketTransportTests(unittest.TestCase):
|
|||
tr = _ProactorSocketTransport(self.loop, self.sock, self.protocol)
|
||||
tr._fatal_error = unittest.mock.Mock()
|
||||
tr._loop_reading()
|
||||
tr._fatal_error.assert_called_with(err)
|
||||
tr._fatal_error.assert_called_with(
|
||||
err,
|
||||
'Fatal read error on pipe transport')
|
||||
|
||||
def test_loop_reading_aborted_closing(self):
|
||||
self.loop._proactor.recv.side_effect = ConnectionAbortedError()
|
||||
|
@ -105,7 +107,9 @@ class ProactorSocketTransportTests(unittest.TestCase):
|
|||
tr = _ProactorSocketTransport(self.loop, self.sock, self.protocol)
|
||||
tr._fatal_error = unittest.mock.Mock()
|
||||
tr._loop_reading()
|
||||
tr._fatal_error.assert_called_with(err)
|
||||
tr._fatal_error.assert_called_with(
|
||||
err,
|
||||
'Fatal read error on pipe transport')
|
||||
|
||||
def test_write(self):
|
||||
tr = _ProactorSocketTransport(self.loop, self.sock, self.protocol)
|
||||
|
@ -142,7 +146,9 @@ class ProactorSocketTransportTests(unittest.TestCase):
|
|||
tr._fatal_error = unittest.mock.Mock()
|
||||
tr._buffer = [b'da', b'ta']
|
||||
tr._loop_writing()
|
||||
tr._fatal_error.assert_called_with(err)
|
||||
tr._fatal_error.assert_called_with(
|
||||
err,
|
||||
'Fatal write error on pipe transport')
|
||||
tr._conn_lost = 1
|
||||
|
||||
tr.write(b'data')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue