<?xml version="1.0" encoding="ascii"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>flumotion.twisted.integration</title> <link rel="stylesheet" href="epydoc.css" type="text/css" /> <script type="text/javascript" src="epydoc.js"></script> </head> <body bgcolor="white" text="black" link="blue" vlink="#204080" alink="#204080"> <!-- ==================== NAVIGATION BAR ==================== --> <table class="navbar" border="0" width="100%" cellpadding="0" bgcolor="#a0c0ff" cellspacing="0"> <tr valign="middle"> <!-- Tree link --> <th> <a href="module-tree.html">Trees</a> </th> <!-- Index link --> <th> <a href="identifier-index.html">Indices</a> </th> <!-- Help link --> <th> <a href="help.html">Help</a> </th> <th class="navbar" width="100%"></th> </tr> </table> <table width="100%" cellpadding="0" cellspacing="0"> <tr valign="top"> <td width="100%"> <span class="breadcrumbs"> Package flumotion :: <a href="flumotion.twisted-module.html">Package twisted</a> :: Module integration </span> </td> <td> <table cellpadding="0" cellspacing="0"> <!-- hide/show private --> <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink" onclick="toggle_private();">hide private</a>]</span></td></tr> </table> </td> </tr> </table> <!-- ==================== MODULE DESCRIPTION ==================== --> <h1 class="epydoc">Module integration</h1><p class="nomargin-top"><span class="codelink"><a href="flumotion.twisted.integration-pysrc.html">source code</a></span></p> <p>Framework for writing automated integration tests.</p> <p>This module provides a way of writing automated integration tests from within Twisted's unit testing framework, trial. Test cases are constructed as subclasses of the normal trial <a href="flumotion.common.testsuite.TestCase-class.html" class="link">twisted.trial.unittest.TestCase</a> class.</p> <p>Integration tests look like normal test methods, except that they are decorated with <a href="flumotion.twisted.integration-module.html#test" class="link">integration.test</a>, take an extra "plan" argument, and do not return anything. For example:</p> <pre class="literalblock"> from twisted.trial import unittest from flumotion.twisted import integration class IntegrationTestExample(unittest.TestCase): @integration.test def testEchoFunctionality(self, plan): process = plan.spawn('echo', 'hello world') plan.wait(process, 0) </pre> <p>This example will spawn a process, as if you typed "echo 'hello world'" at the shell prompt. It then waits for the process to exit, expecting the exit status to be 0.</p> <p>The example illustrates two of the fundamental plan operators, spawn and wait. "spawn" spawns a process. "wait" waits for a process to finish. The other operators are "spawnPar", which spawns a number of processes in parallel, "waitPar", which waits for a number of processes in parallel, and "kill", which kills one or more processes via SIGTERM and then waits for them to exit.</p> <p>It is evident that this framework is most appropriate for testing the integration of multiple processes, and is not suitable for in-process tests. The plan that is built up is only executed after the test method exits, via the <a href="flumotion.twisted.integration-module.html#test" class="link">integration.test</a> decorator; the writer of the integration test does not have access to the plan's state.</p> <p>Note that all process exits must be anticipated. If at any point the integration tester receives SIGCHLD, the next operation must be a wait for that process. If this is not the case, the test is interpreted as having failed.</p> <p>Also note that while the test is running, the stdout and stderr of each spawned process is redirected into log files in a subdirectory of where the test is located. For example, in the previous example, the following files will be created:</p> <pre class="literalblock"> $testdir/IntegrationTestExample-$date/testEchoFunctionality/echo.stdout $testdir/IntegrationTestExample-$date/testEchoFunctionality/echo.stderr </pre> <p>In the case that multiple echo commands are run in the same plan, the subsequent commands will be named as echo-1, echo-2, and the like. Upon successful completion of the test case, the log directory will be deleted.</p> <hr /> <div class="fields"> <p><strong>Version:</strong> $Rev: 7162 $ </p> </div><!-- ==================== CLASSES ==================== --> <a name="section-Classes"></a> <table class="summary" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr bgcolor="#70b0f0" class="table-header"> <td colspan="2" class="table-header"> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr valign="top"> <td align="left"><span class="table-header">Classes</span></td> <td align="right" valign="top" ><span class="options">[<a href="#section-Classes" class="privatelink" onclick="toggle_private();" >hide private</a>]</span></td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <a href="flumotion.twisted.integration.UnexpectedExitCodeException-class.html" class="summary-name">UnexpectedExitCodeException</a> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <a href="flumotion.twisted.integration.UnexpectedExitException-class.html" class="summary-name">UnexpectedExitException</a> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <a href="flumotion.twisted.integration.CommandNotFoundException-class.html" class="summary-name">CommandNotFoundException</a> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <a href="flumotion.twisted.integration.ProcessesStillRunningException-class.html" class="summary-name">ProcessesStillRunningException</a> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <a href="flumotion.twisted.integration.TimeoutException-class.html" class="summary-name">TimeoutException</a> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <a href="flumotion.twisted.integration.ProcessProtocol-class.html" class="summary-name">ProcessProtocol</a> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <a href="flumotion.twisted.integration.Process-class.html" class="summary-name">Process</a> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <a href="flumotion.twisted.integration.PlanExecutor-class.html" class="summary-name">PlanExecutor</a> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <a href="flumotion.twisted.integration.Plan-class.html" class="summary-name">Plan</a> </td> </tr> </table> <!-- ==================== FUNCTIONS ==================== --> <a name="section-Functions"></a> <table class="summary" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr bgcolor="#70b0f0" class="table-header"> <td colspan="2" class="table-header"> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr valign="top"> <td align="left"><span class="table-header">Functions</span></td> <td align="right" valign="top" ><span class="options">[<a href="#section-Functions" class="privatelink" onclick="toggle_private();" >hide private</a>]</span></td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a name="log"></a><span class="summary-sig-name">log</span>(<span class="summary-sig-arg">format</span>, <span class="summary-sig-arg">*args</span>)</span></td> <td align="right" valign="top"> <span class="codelink"><a href="flumotion.twisted.integration-pysrc.html#log">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a name="debug"></a><span class="summary-sig-name">debug</span>(<span class="summary-sig-arg">format</span>, <span class="summary-sig-arg">*args</span>)</span></td> <td align="right" valign="top"> <span class="codelink"><a href="flumotion.twisted.integration-pysrc.html#debug">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a name="info"></a><span class="summary-sig-name">info</span>(<span class="summary-sig-arg">format</span>, <span class="summary-sig-arg">*args</span>)</span></td> <td align="right" valign="top"> <span class="codelink"><a href="flumotion.twisted.integration-pysrc.html#info">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a name="warning"></a><span class="summary-sig-name">warning</span>(<span class="summary-sig-arg">format</span>, <span class="summary-sig-arg">*args</span>)</span></td> <td align="right" valign="top"> <span class="codelink"><a href="flumotion.twisted.integration-pysrc.html#warning">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a name="error"></a><span class="summary-sig-name">error</span>(<span class="summary-sig-arg">format</span>, <span class="summary-sig-arg">*args</span>)</span></td> <td align="right" valign="top"> <span class="codelink"><a href="flumotion.twisted.integration-pysrc.html#error">source code</a></span> </td> </tr> </table> </td> </tr> <tr class="private"> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a name="_which"></a><span class="summary-sig-name">_which</span>(<span class="summary-sig-arg">executable</span>)</span></td> <td align="right" valign="top"> <span class="codelink"><a href="flumotion.twisted.integration-pysrc.html#_which">source code</a></span> </td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a name="test"></a><span class="summary-sig-name">test</span>(<span class="summary-sig-arg">proc</span>)</span></td> <td align="right" valign="top"> <span class="codelink"><a href="flumotion.twisted.integration-pysrc.html#test">source code</a></span> </td> </tr> </table> </td> </tr> </table> <!-- ==================== VARIABLES ==================== --> <a name="section-Variables"></a> <table class="summary" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr bgcolor="#70b0f0" class="table-header"> <td colspan="2" class="table-header"> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr valign="top"> <td align="left"><span class="table-header">Variables</span></td> <td align="right" valign="top" ><span class="options">[<a href="#section-Variables" class="privatelink" onclick="toggle_private();" >hide private</a>]</span></td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <a name="__package__"></a><span class="summary-name">__package__</span> = <code title="'flumotion.twisted'"><code class="variable-quote">'</code><code class="variable-string">flumotion.twisted</code><code class="variable-quote">'</code></code> </td> </tr> </table> <!-- ==================== NAVIGATION BAR ==================== --> <table class="navbar" border="0" width="100%" cellpadding="0" bgcolor="#a0c0ff" cellspacing="0"> <tr valign="middle"> <!-- Tree link --> <th> <a href="module-tree.html">Trees</a> </th> <!-- Index link --> <th> <a href="identifier-index.html">Indices</a> </th> <!-- Help link --> <th> <a href="help.html">Help</a> </th> <th class="navbar" width="100%"></th> </tr> </table> <table border="0" cellpadding="0" cellspacing="0" width="100%%"> <tr> <td align="left" class="footer"> Generated by Epydoc 3.0.1 on Wed Aug 11 21:33:11 2010 </td> <td align="right" class="footer"> <a target="mainFrame" href="http://epydoc.sourceforge.net" >http://epydoc.sourceforge.net</a> </td> </tr> </table> <script type="text/javascript"> <!-- // Private objects are initially displayed (because if // javascript is turned off then we want them to be // visible); but by default, we want to hide them. So hide // them unless we have a cookie that says to show them. checkCookie(); // --> </script> </body> </html>