| 1 |
<?xml version="1.0" encoding="utf-8" ?> |
| 2 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| 3 |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
| 4 |
<head> |
| 5 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
| 6 |
<meta name="generator" content="Docutils 0.4: http://docutils.sourceforge.net/" /> |
| 7 |
<title>Tests and Examples</title> |
| 8 |
<link rel="stylesheet" href="html4css1.css" type="text/css" /> |
| 9 |
</head> |
| 10 |
<body> |
| 11 |
<div class="header"> |
| 12 |
<a class="reference" href="programming-guidelines.html">Prev</a> <a class="reference" href="index.html">Up</a> <a class="reference" href="tests.html">Next</a> |
| 13 |
<hr class="header"/> |
| 14 |
</div> |
| 15 |
<div class="document" id="tests-and-examples"> |
| 16 |
<h1 class="title">Tests and Examples</h1> |
| 17 |
<p><tt class="docutils literal"><span class="pre">processing</span></tt> contains a <tt class="docutils literal"><span class="pre">test</span></tt> sub-package which contains unit tests |
| 18 |
for the package. You can do a test run by doing</p> |
| 19 |
<pre class="literal-block"> |
| 20 |
python -m processing.tests |
| 21 |
</pre> |
| 22 |
<p>on Python 2.5 or</p> |
| 23 |
<pre class="literal-block"> |
| 24 |
python -c "from processing.tests import main; main()" |
| 25 |
</pre> |
| 26 |
<p>on Python 2.4. This will run many of the tests using processes, |
| 27 |
threads, and processes with a manager.</p> |
| 28 |
<p>The <tt class="docutils literal"><span class="pre">example</span></tt> sub-package contains the following modules:</p> |
| 29 |
<blockquote> |
| 30 |
<dl class="docutils"> |
| 31 |
<dt><a class="reference" href="../examples/ex_newtype.py">ex_newtype.py</a></dt> |
| 32 |
<dd>Demonstration of how to create and use customized managers |
| 33 |
and proxies.</dd> |
| 34 |
<dt><a class="reference" href="../examples/ex_pool.py">ex_pool.py</a></dt> |
| 35 |
<dd>Test of the <tt class="docutils literal"><span class="pre">Pool</span></tt> class which represents a process pool.</dd> |
| 36 |
<dt><a class="reference" href="../examples/ex_synchronize.py">ex_synchronize.py</a></dt> |
| 37 |
<dd>Test of synchronization types like locks, conditions and queues.</dd> |
| 38 |
<dt><a class="reference" href="../examples/ex_workers.py">ex_workers.py</a></dt> |
| 39 |
<dd>A test showing how to use queues to feed tasks to a |
| 40 |
collection of worker process and collect the results.</dd> |
| 41 |
<dt><a class="reference" href="../examples/ex_webserver.py">ex_webserver.py</a></dt> |
| 42 |
<dd>An example of how a pool of worker processes can each |
| 43 |
run a <tt class="docutils literal"><span class="pre">SimpleHTTPServer.HttpServer</span></tt> instance |
| 44 |
while sharing a single listening socket.</dd> |
| 45 |
<dt><a class="reference" href="../examples/benchmarks.py">benchmarks.py</a></dt> |
| 46 |
<dd>Some simple benchmarks comparing <tt class="docutils literal"><span class="pre">processing</span></tt> with <tt class="docutils literal"><span class="pre">threading</span></tt>.</dd> |
| 47 |
</dl> |
| 48 |
</blockquote> |
| 49 |
</div> |
| 50 |
<div class="footer"> |
| 51 |
<hr class="footer" /> |
| 52 |
<a class="reference" href="programming-guidelines.html">Prev</a> <a class="reference" href="index.html">Up</a> <a class="reference" href="tests.html">Next</a> |
| 53 |
</div> |
| 54 |
</body> |
| 55 |
</html> |