mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-27 10:26:23 +00:00
e037fe05ff
All the content of the pathod docs are moved into Sphinx. The interactive format has not translated well to static docs, and there's still a lot of rewriting, format fixing, structuring, etc to be done.
36 lines
1.0 KiB
ReStructuredText
36 lines
1.0 KiB
ReStructuredText
.. _test:
|
|
|
|
pathod.test
|
|
===========
|
|
|
|
The **pathod.test** module is a light, flexible testing layer for HTTP clients.
|
|
It works by firing up a Pathod instance in a separate thread, letting you use
|
|
Pathod's full abilities to generate responses, and then query Pathod's internal
|
|
logs to establish what happened. All the mechanics of startup, shutdown, finding
|
|
free ports and so forth are taken care of for you.
|
|
|
|
The canonical docs can be accessed using pydoc:
|
|
|
|
>>> pydoc pathod.test
|
|
|
|
The remainder of this page demonstrates some common interaction patterns using
|
|
<a href="http://nose.readthedocs.org/en/latest/">nose</a>. These examples are
|
|
also applicable with only minor modification to most commonly used Python testing
|
|
engines.
|
|
|
|
|
|
Context Manager
|
|
---------------
|
|
|
|
.. literalinclude:: ../../examples/pathod/test_context.py
|
|
:caption: examples/pathod/test_context.py
|
|
:language: python
|
|
|
|
|
|
One instance per test
|
|
---------------------
|
|
|
|
.. literalinclude:: ../../examples/pathod/test_setup.py
|
|
:caption: examples/pathod/test_setup.py
|
|
:language: python
|