mitmproxy/libpathod/templates/docs_test.html

51 lines
1.4 KiB
HTML
Raw Normal View History

2015-06-22 13:12:20 +00:00
{% extends "docframe.html" %} {% block body %}
2012-06-23 23:14:54 +00:00
<div class="page-header">
2015-06-22 13:12:20 +00:00
<h1>
2012-06-23 23:14:54 +00:00
libpathod.test
2015-06-22 13:12:20 +00:00
<small>Using libpathod in unit tests.</small>
2012-06-23 23:14:54 +00:00
</h1>
</div>
2012-07-30 08:58:59 +00:00
2015-06-22 13:12:20 +00:00
<p>The <b>libpathod.test</b> module is a light, flexible testing layer for HTTP clients.
2015-06-26 09:47:39 +00:00
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.
2015-06-22 13:12:20 +00:00
</p>
2012-07-30 08:58:59 +00:00
2015-06-22 13:12:20 +00:00
<p>The canonical docs can be accessed using pydoc: </p>
2012-07-30 08:58:59 +00:00
2015-06-22 13:12:20 +00:00
<pre class="terminal">pydoc libpathod.test</pre>
2012-07-30 08:58:59 +00:00
2015-06-22 13:12:20 +00:00
<p>
The remainder of this page demonstrates some common interaction patterns using
2015-06-26 09:47:39 +00:00
<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.
2015-06-22 13:12:20 +00:00
</p>
2012-07-30 08:58:59 +00:00
2015-06-22 13:12:20 +00:00
<section>
<div class="page-header">
<h1>Context Manager</h1>
2012-07-30 08:58:59 +00:00
</div>
2015-06-22 13:12:20 +00:00
{% include "examples_context.html" %}
</section>
2012-07-30 08:58:59 +00:00
2015-06-22 13:12:20 +00:00
<section>
<div class="page-header">
<h1>One instance per test</h1>
2012-07-30 08:58:59 +00:00
</div>
2015-06-22 13:12:20 +00:00
{% include "examples_setup.html" %}
</section>
2012-07-30 08:58:59 +00:00
2015-06-22 13:12:20 +00:00
<section>
<div class="page-header">
<h1>One instance per suite</h1>
</div>
2012-07-30 08:58:59 +00:00
2015-06-22 13:12:20 +00:00
{% include "examples_setupall.html" %}
</section>
{% endblock %}