mirror of https://github.com/python/cpython
gh-98703: Add tests for closing `_ProactorSocketTransport` with proactor event loop (GH-98730)
This commit is contained in:
parent
8a755423eb
commit
96ae80f1d0
|
@ -297,6 +297,27 @@ class ProactorSocketTransportTests(test_utils.TestCase):
|
||||||
# and waiters will never be notified leading to hang.
|
# and waiters will never be notified leading to hang.
|
||||||
self.assertTrue(self.protocol.connection_lost.called)
|
self.assertTrue(self.protocol.connection_lost.called)
|
||||||
|
|
||||||
|
def test_force_close_protocol_connection_lost_once(self):
|
||||||
|
tr = self.socket_transport()
|
||||||
|
self.assertFalse(self.protocol.connection_lost.called)
|
||||||
|
tr._closing = True
|
||||||
|
# Calling _force_close twice should not call
|
||||||
|
# protocol.connection_lost twice
|
||||||
|
tr._force_close(None)
|
||||||
|
tr._force_close(None)
|
||||||
|
test_utils.run_briefly(self.loop)
|
||||||
|
self.assertEqual(1, self.protocol.connection_lost.call_count)
|
||||||
|
|
||||||
|
def test_close_protocol_connection_lost_once(self):
|
||||||
|
tr = self.socket_transport()
|
||||||
|
self.assertFalse(self.protocol.connection_lost.called)
|
||||||
|
# Calling close twice should not call
|
||||||
|
# protocol.connection_lost twice
|
||||||
|
tr.close()
|
||||||
|
tr.close()
|
||||||
|
test_utils.run_briefly(self.loop)
|
||||||
|
self.assertEqual(1, self.protocol.connection_lost.call_count)
|
||||||
|
|
||||||
def test_fatal_error_2(self):
|
def test_fatal_error_2(self):
|
||||||
tr = self.socket_transport()
|
tr = self.socket_transport()
|
||||||
tr._buffer = [b'data']
|
tr._buffer = [b'data']
|
||||||
|
|
Loading…
Reference in New Issue