Skip to content

Commit 8b7ae46

Browse files
committed
doc: fix and improve documentation
Fix links, add a bit of a text to the guide, and update api.rst to have proper links to the classes in the TOC.
1 parent 173a86e commit 8b7ae46

4 files changed

Lines changed: 43 additions & 9 deletions

File tree

doc/api.rst

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,41 @@
11
API documentation
22
=================
33

4+
pytest_httpserver
5+
-----------------
6+
47
.. automodule:: pytest_httpserver
58

9+
HTTPServer
10+
~~~~~~~~~~
11+
612
.. autoclass:: HTTPServer
713
:members:
814

15+
WaitingSettings
16+
~~~~~~~~~~~~~~~
17+
18+
.. autoclass:: WaitingSettings
19+
:members:
20+
21+
HeaderValueMatcher
22+
~~~~~~~~~~~~~~~~~~
23+
24+
.. autoclass:: HeaderValueMatcher
25+
:members:
26+
27+
RequestHandler
28+
~~~~~~~~~~~~~~
29+
30+
.. autoclass:: RequestHandler
31+
:members:
32+
33+
34+
pytest_httpserver.httpserver
35+
----------------------------
36+
This module contains some internal classes which are normally not instantiated
37+
by the user.
38+
939
.. automodule:: pytest_httpserver.httpserver
1040

1141
.. autoclass:: RequestMatcher
@@ -20,12 +50,6 @@ API documentation
2050
.. autoclass:: pytest_httpserver.httpserver.HTTPServerError
2151
:members:
2252

23-
.. autoclass:: pytest_httpserver.httpserver.HeaderValueMatcher
24-
:members:
25-
26-
.. autoclass:: pytest_httpserver.httpserver.RequestHandler
27-
:members:
28-
2953
.. autoclass:: pytest_httpserver.httpserver.RequestHandlerList
3054
:members:
3155

doc/guide.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,13 @@ When dealing with static responses you can determine all parts of the http respo
5050
content, etc), and you can also specify a JSON-serializable object to be returned as a json.
5151

5252

53+
Waiting for test completion or errors
54+
-------------------------------------
55+
It is possible to wait until all oneshot and ordered handlers are exhausted or any error happened. This
56+
is provided by a context manager which waits until one of these events occured. This can be further customized
57+
by :py:class:`pytest_httpserver.server.WaitSettings` object to raise or not raise assertion.
58+
59+
5360
Debugging errors while testing
5461
------------------------------
5562
When the tests are running against the server and no matcher can be found for the given request, the server

doc/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Example
3434
For further details, please read the :doc:`guide` or the :doc:`api`.
3535

3636
.. toctree::
37-
:maxdepth: 1
37+
:maxdepth: 2
3838

3939
guide
4040
api

pytest_httpserver/httpserver.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -615,8 +615,8 @@ def start(self):
615615
program needs to be terminated by Ctrl+C or by signal as it will not terminate until
616616
the thred is stopped.
617617
618-
If the sever is already running :py:class`HTTPServerError` will be raised. If you are
619-
unsure, call :py:meth`is_running` first.
618+
If the sever is already running :py:class:`HTTPServerError` will be raised. If you are
619+
unsure, call :py:meth:`is_running` first.
620620
621621
There's a context interface of this class which stops the server when the context block ends.
622622
"""
@@ -799,6 +799,9 @@ def wait(self, raise_assertions: Optional[bool] = None, stop_on_nohandler: Optio
799799
:param timeout: time (in seconds) until time is out
800800
801801
Example:
802+
803+
.. code-block:: python
804+
802805
def test_wait(httpserver):
803806
httpserver.expect_oneshot_request('/').respond_with_data('OK')
804807
with httpserver.wait(raise_assertions=False, stop_on_nohandler=False, timeout=1) as waiting:

0 commit comments

Comments
 (0)