Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(4)

Side by Side Diff: Lib/test/test_asyncio/test_base_events.py

Issue 27906: Socket accept exhaustion during high TCP traffic
Patch Set: Created 3 years, 6 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Lib/asyncio/selector_events.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 """Tests for base_events.py""" 1 """Tests for base_events.py"""
2 2
3 import errno 3 import errno
4 import logging 4 import logging
5 import math 5 import math
6 import os 6 import os
7 import socket 7 import socket
8 import sys 8 import sys
9 import threading 9 import threading
10 import time 10 import time
(...skipping 1616 matching lines...) Expand 10 before | Expand all | Expand 10 after
1627 self.loop.remove_reader = mock.Mock() 1627 self.loop.remove_reader = mock.Mock()
1628 self.loop.call_later = mock.Mock() 1628 self.loop.call_later = mock.Mock()
1629 1629
1630 self.loop._accept_connection(MyProto, sock) 1630 self.loop._accept_connection(MyProto, sock)
1631 self.assertTrue(m_log.error.called) 1631 self.assertTrue(m_log.error.called)
1632 self.assertFalse(sock.close.called) 1632 self.assertFalse(sock.close.called)
1633 self.loop.remove_reader.assert_called_with(10) 1633 self.loop.remove_reader.assert_called_with(10)
1634 self.loop.call_later.assert_called_with(constants.ACCEPT_RETRY_DELAY, 1634 self.loop.call_later.assert_called_with(constants.ACCEPT_RETRY_DELAY,
1635 # self.loop._start_serving 1635 # self.loop._start_serving
1636 mock.ANY, 1636 mock.ANY,
1637 MyProto, sock, None, None) 1637 MyProto, sock, None, None, mock. ANY)
1638 1638
1639 def test_call_coroutine(self): 1639 def test_call_coroutine(self):
1640 @asyncio.coroutine 1640 @asyncio.coroutine
1641 def simple_coroutine(): 1641 def simple_coroutine():
1642 pass 1642 pass
1643 1643
1644 coro_func = simple_coroutine 1644 coro_func = simple_coroutine
1645 coro_obj = coro_func() 1645 coro_obj = coro_func()
1646 self.addCleanup(coro_obj.close) 1646 self.addCleanup(coro_obj.close)
1647 for func in (coro_func, coro_obj): 1647 for func in (coro_func, coro_obj):
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1682 asyncio.ensure_future(stop_loop_coro(self.loop), loop=self.loop) 1682 asyncio.ensure_future(stop_loop_coro(self.loop), loop=self.loop)
1683 self.loop.run_forever() 1683 self.loop.run_forever()
1684 fmt, *args = m_logger.warning.call_args[0] 1684 fmt, *args = m_logger.warning.call_args[0]
1685 self.assertRegex(fmt % tuple(args), 1685 self.assertRegex(fmt % tuple(args),
1686 "^Executing <Task.*stop_loop_coro.*> " 1686 "^Executing <Task.*stop_loop_coro.*> "
1687 "took .* seconds$") 1687 "took .* seconds$")
1688 1688
1689 1689
1690 if __name__ == '__main__': 1690 if __name__ == '__main__':
1691 unittest.main() 1691 unittest.main()
OLDNEW
« no previous file with comments | « Lib/asyncio/selector_events.py ('k') | no next file » | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+