2013-05-01 21:11:16 +00:00
|
|
|
{% extends "docframe.html" %}
|
2012-06-28 23:53:59 +00:00
|
|
|
{% block body %}
|
2012-06-23 23:14:54 +00:00
|
|
|
<div class="page-header">
|
|
|
|
<h1>
|
|
|
|
libpathod.test
|
|
|
|
<small>Using pathod and pathoc in your unit tests.</small>
|
|
|
|
</h1>
|
|
|
|
</div>
|
2012-07-30 08:58:59 +00:00
|
|
|
|
|
|
|
<div class="row">
|
|
|
|
<div class="span6">
|
|
|
|
|
|
|
|
<p> The <b>libpathod.test</b> 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. </p>
|
|
|
|
|
|
|
|
<p> The canonical docs can be accessed using pydoc: </p>
|
|
|
|
|
2012-07-30 09:12:42 +00:00
|
|
|
<pre class="terminal">pydoc libpathod.test</pre>
|
2012-07-30 08:58:59 +00:00
|
|
|
|
|
|
|
<p> 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.</p>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<div class="span6">
|
2012-08-07 11:19:48 +00:00
|
|
|
<h1> Context Manager </h1>
|
2012-07-30 08:58:59 +00:00
|
|
|
|
|
|
|
{% include "examples_context.html" %}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="row">
|
|
|
|
<div class="span6">
|
|
|
|
<h1> One instance per test </h1>
|
|
|
|
|
|
|
|
{% include "examples_setup.html" %}
|
|
|
|
</div>
|
|
|
|
<div class="span6">
|
|
|
|
<h1> One instance per suite </h1>
|
|
|
|
|
|
|
|
{% include "examples_setupall.html" %}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
2012-06-28 23:53:59 +00:00
|
|
|
{% endblock %}
|