MCPcopy
hub / github.com/benoitc/gunicorn / test_accept_success

Method test_accept_success

tests/test_gthread.py:523–537  ·  view source on GitHub ↗

Test successful connection acceptance.

(self)

Source from the content-addressed store, hash-verified

521 return worker
522
523 def test_accept_success(self):
524 """Test successful connection acceptance."""
525 worker = self.create_worker()
526 worker.nr_conns = 0
527
528 client_sock = FakeSocket()
529 client_addr = ('127.0.0.1', 12345)
530 listener = mock.Mock()
531 listener.accept.return_value = (client_sock, client_addr)
532 listener.getsockname.return_value = ('127.0.0.1', 8000)
533
534 worker.accept(listener)
535
536 assert worker.nr_conns == 1
537 worker.tpool.submit.assert_called_once()
538
539 def test_accept_eagain(self):
540 """Test handling of EAGAIN during accept."""

Callers

nothing calls this directly

Calls 3

create_workerMethod · 0.95
FakeSocketClass · 0.70
acceptMethod · 0.45

Tested by

no test coverage detected