Create a GeventWorker instance for testing.
(self)
| 307 | |
| 308 | @pytest.fixture |
| 309 | def gevent_worker(self): |
| 310 | """Create a GeventWorker instance for testing.""" |
| 311 | try: |
| 312 | import gevent |
| 313 | except ImportError: |
| 314 | pytest.skip("gevent not available") |
| 315 | |
| 316 | from gunicorn.workers.ggevent import GeventWorker |
| 317 | |
| 318 | worker = GeventWorker.__new__(GeventWorker) |
| 319 | worker.cfg = mock.MagicMock() |
| 320 | worker.cfg.keepalive = 2 |
| 321 | worker.cfg.do_handshake_on_connect = False |
| 322 | worker.cfg.http_protocols = ["h2", "h1"] |
| 323 | worker.cfg.is_ssl = True |
| 324 | worker.alive = True |
| 325 | worker.log = mock.MagicMock() |
| 326 | worker.wsgi = mock.MagicMock() |
| 327 | worker.nr = 0 |
| 328 | worker.max_requests = 1000 |
| 329 | worker.worker_connections = 1000 |
| 330 | |
| 331 | return worker |
| 332 | |
| 333 | def test_gevent_inherits_async_worker(self): |
| 334 | """Test that GeventWorker inherits from AsyncWorker.""" |