1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
<meta content="text/html;charset=ISO-8859-1" name="Content-Type"/>
6
<link href="../../style.css" media="screen" rel="stylesheet" type="text/css"/></head>
9
<div><a href="http://pylib.org"><img alt="py lib" height="57" id="pyimg" src="http://codespeak.net/img/pylib.png" width="77"/></a></div>
12
<div><a class="menu" href="../../announce/release-1.2.1.html">1.2.1 ANN</a></div></div>
14
<div><a class="menu" href="../../install.html">INSTALL</a></div></div>
16
<div><a class="menu" href="../../contact.html">CONTACT</a></div></div>
18
<div><a class="menu" href="../../changelog.html">CHANGELOG</a></div></div>
20
<div><a class="menu" href="../../faq.html">FAQ</a></div></div>
24
<div><a class="menu" href="../index.html">Index</a></div>
25
<div><a class="menu" href="../quickstart.html">Quickstart</a></div>
26
<div><a class="menu" href="../features.html">Features</a></div>
27
<div><a class="menu" href="index.html">Plugins</a></div>
28
<div><a class="menu" href="../funcargs.html">Funcargs</a></div>
29
<div><a class="menu" href="../customize.html">Customize</a></div>
30
<div><a class="menu" href="../talks.html">Tutorials</a></div></div></div>
33
<h3>supporting APIs:</h3>
34
<div><a class="menu" href="../../index.html">Index</a></div>
35
<div><a class="menu" href="../../path.html">py.path</a></div>
36
<div><a class="menu" href="../../code.html">py.code</a></div></div></div></div></div>
37
<div id="contentspace">
40
<div class="section" id="provide-temporary-directories-to-test-functions">
41
<h1>provide temporary directories to test functions.</h1>
42
<div class="contents local topic" id="contents">
44
<li><a class="reference internal" href="#the-tmpdir-test-function-argument" id="id1">the 'tmpdir' test function argument</a></li>
48
<pre class="literal-block">
49
def test_plugin(tmpdir):
50
tmpdir.join("hello").write("hello")
52
<div class="section" id="the-tmpdir-test-function-argument">
53
<span id="tmpdir-funcarg"></span><h2><a class="toc-backref" href="#id1">the 'tmpdir' test function argument</a></h2>
54
<p>return a temporary directory path object
55
unique to each test function invocation,
56
created as a sub directory of the base temporary
57
directory. The returned object is a <a class="reference external" href="../../path.html">py.path.local</a>
61
<div class="section" id="start-improving-this-plugin-in-30-seconds">
62
<h1>Start improving this plugin in 30 seconds</h1>
63
<ol class="arabic simple">
64
<li>Download <a class="reference external" href="http://bitbucket.org/hpk42/py-trunk/raw/1.2.0/py/_plugin/pytest_tmpdir.py">pytest_tmpdir.py</a> plugin source code</li>
65
<li>put it somewhere as <tt class="docutils literal">pytest_tmpdir.py</tt> into your import path</li>
66
<li>a subsequent <tt class="docutils literal">py.test</tt> run will use your local version</li>
68
<p>Checkout <a class="reference external" href="../customize.html">customize</a>, other <a class="reference external" href="index.html">plugins</a> or <a class="reference external" href="../../contact.html">get in contact</a>.</p>
71
<script type="text/javascript">
72
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
73
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
75
<script type="text/javascript">
77
var pageTracker = _gat._getTracker("UA-7597274-3");
78
pageTracker._trackPageview();
79
} catch(err) {}</script>
b'\\ No newline at end of file'