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

Method create_worker

tests/test_gtornado.py:92–107  ·  view source on GitHub ↗

Create a worker instance for testing.

(self, cfg=None)

Source from the content-addressed store, hash-verified

90 """Tests for request counting and max_requests behavior."""
91
92 def create_worker(self, cfg=None):
93 """Create a worker instance for testing."""
94 if cfg is None:
95 cfg = Config()
96 cfg.set('workers', 1)
97
98 worker = gtornado.TornadoWorker(
99 age=1,
100 ppid=os.getpid(),
101 sockets=[],
102 app=mock.Mock(),
103 timeout=30,
104 cfg=cfg,
105 log=mock.Mock(),
106 )
107 return worker
108
109 def test_handle_request_increments_counter(self):
110 """Test that handle_request increments the request counter."""

Calls 2

setMethod · 0.95
ConfigClass · 0.90

Tested by

no test coverage detected