@@ -299,6 +299,41 @@ the ``httpserver`` fixture).
299299 return (" 127.0.0.1" , 8000 )
300300
301301
302+ Waiting for server to be ready
303+ ------------------------------
304+
305+ By default, the ``httpserver `` fixture ensures that the server is bound to the
306+ configured address and listening for incoming connections. While this is
307+ sufficient for most use cases, you can optionally wait for the server to be
308+ fully ready to serve HTTP requests before proceeding with your tests. This is
309+ particularly useful when your client has strict timeout requirements or when the
310+ HTTP server has a slow startup time.
311+
312+ To enable this check, *pytest-httpserver * issues an HTTP probe request to the
313+ server before your test starts to ensure the server is ready to serve requests.
314+ You can configure the timeout for this probe request as needed.
315+
316+
317+ .. warning ::
318+
319+ This check is not supported in SSL mode, as the probe request is not
320+ configured to accept the self-signed certificate used by the server. To
321+ enable this feature with SSL, override the ``wait_for_server_ready() ``
322+ method with your implementation.
323+
324+
325+ To enable this feature, set the ``startup_timeout `` keyword argument when
326+ initializing ``HTTPServer ``. This parameter specifies the maximum time to wait
327+ for the server to become ready to serve HTTP requests.
328+
329+
330+ .. literalinclude :: ../tests/examples/test_howto_readiness.py
331+ :language: python
332+
333+
334+ In the case the server times out, the test will fail.
335+
336+
302337Multi-threading support
303338-----------------------
304339
0 commit comments