Create a test worker for benchmarks.
()
| 122 | |
| 123 | |
| 124 | def create_worker(): |
| 125 | """Create a test worker for benchmarks.""" |
| 126 | cfg = Config() |
| 127 | cfg.set("dirty_timeout", 300) |
| 128 | log = MockLog() |
| 129 | |
| 130 | with mock.patch('gunicorn.dirty.worker.WorkerTmp'): |
| 131 | worker = DirtyWorker( |
| 132 | age=1, |
| 133 | ppid=os.getpid(), |
| 134 | app_paths=["benchmark:App"], |
| 135 | cfg=cfg, |
| 136 | log=log, |
| 137 | socket_path="/tmp/benchmark.sock" |
| 138 | ) |
| 139 | |
| 140 | worker.apps = {} |
| 141 | worker._executor = None |
| 142 | worker.tmp = mock.Mock() |
| 143 | |
| 144 | return worker |
| 145 | |
| 146 | |
| 147 | def create_arbiter(): |
no test coverage detected