[py-svn] r56323 - py/extradoc/talk/ep2008
hpk at codespeak.net
hpk at codespeak.net
Sat Jul 5 08:30:21 CEST 2008
Author: hpk
Date: Sat Jul 5 08:30:19 2008
New Revision: 56323
Modified:
py/extradoc/talk/ep2008/pytest.html
py/extradoc/talk/ep2008/pytest.txt
Log:
add some info for the js/py_unit conftests, and another conftest
Modified: py/extradoc/talk/ep2008/pytest.html
==============================================================================
--- py/extradoc/talk/ep2008/pytest.html (original)
+++ py/extradoc/talk/ep2008/pytest.html Sat Jul 5 08:30:19 2008
@@ -556,8 +556,7 @@
<h1>Important Internal Objects</h1>
<p><strong>Session</strong>: iterates over (custom) collection tree, executes
tests and reports outcomes.</p>
-<p>Collection Nodes ("py.test.collect.*"):
-XXX insert links?</p>
+<p>Collection Nodes ("py.test.collect.*"):</p>
<p><strong>Directory</strong>: collect files</p>
<p><strong>Module</strong>: collect test Classes and Functions</p>
<p><strong>Class</strong>/<strong>Instance</strong>: collect test methods</p>
@@ -579,6 +578,19 @@
<p>test collection usually starts from directories or files</p>
<p><strong>dynamic lookup of Collector/Item class from conftest.py files</strong></p>
</div>
+<div class="slide" id="example-conftest-py-control-traversal">
+<h1>Example conftest.py: control traversal</h1>
+<p>a conftest.py to influence collection:</p>
+<pre class="literal-block">
+import py
+mydir = py.magic.autopath().dirpath()
+class Directory(py.test.collect.Directory):
+ def run(self):
+ if self.fspath == mydir:
+ return ["x", "y", "z"]
+ return super(Directory, self).run()
+</pre>
+</div>
<div class="slide" id="example-conftest-py-add-rest-check-support">
<h1>Example conftest.py: add ReST check support</h1>
<p>look into py/doc/conftest.py:</p>
@@ -591,7 +603,8 @@
</div>
<div class="slide" id="example-conftest-py-html-page-generation">
<h1>Example conftest.py: html page generation</h1>
-<p><a class="reference" href="http://codespeak.net/svn/user/arigo/hack/misc/htmlconftest">http://codespeak.net/svn/user/arigo/hack/misc/htmlconftest</a></p>
+<p><a class="reference" href="http://codespeak.net/svn/user/arigo/hack/misc/htmlconftest">http://codespeak.net/svn/user/arigo/hack/misc/htmlconftest</a>
+[courtesy Armin Rigo]</p>
<ul class="simple">
<li>creates html output with "clickable" failures</li>
<li>creates a nice historic view on test failures</li>
@@ -601,39 +614,49 @@
</div>
<div class="slide" id="example-conftest-py-run-prolog-tests">
<h1>Example conftest.py: run Prolog tests</h1>
-<p><a class="reference" href="http://codespeak.net/svn/user/cfbolz/jitpl/dist/test/conftest.py">http://codespeak.net/svn/user/cfbolz/jitpl/dist/test/conftest.py</a></p>
+<p><a class="reference" href="http://codespeak.net/svn/user/cfbolz/jitpl/dist/test/conftest.py">http://codespeak.net/svn/user/cfbolz/jitpl/dist/test/conftest.py</a>
+[courtesy Armin Rigo, Carl Friedrich Bolz]</p>
<ul class="simple">
<li>creates PrologTest items</li>
<li>collects items and runs them through Prolog interpreter</li>
</ul>
</div>
-<div class="slide" id="example-conftest-py-run-javascript-tests-in-a-browser">
-<h1>Example conftest.py: run javascript tests (in a browser)</h1>
-<p><a class="reference" href="http://johnnydebris.net/svn/projects/jsbase">http://johnnydebris.net/svn/projects/jsbase</a></p>
-<p>XXX explore and summarize</p>
+<div class="slide" id="example-conftest-py-run-javascript-tests">
+<h1>Example conftest.py: run Javascript tests</h1>
+<p><a class="reference" href="http://johnnydebris.net/svn/projects/jsbase">http://johnnydebris.net/svn/projects/jsbase</a>
+[courtesy Guido Wesdorp]</p>
+<ul class="simple">
+<li>collects Javascript tests</li>
+<li>sends them for execution to Spidermonkey JS interpreter</li>
+</ul>
</div>
<div class="slide" id="example-conftest-py-cross-platform-testing">
<h1>Example conftest.py: cross-platform testing</h1>
+<p>[courtesy Holger Krekel]</p>
<ul class="simple">
<li>goal: remotely run tests on windows</li>
<li>check out py/misc/conftest-socketgatewayrun.py</li>
-<li>requires one small script on the windows side</li>
+<li>requires a small server script on the windows side</li>
<li>transfers your source code to windows, runs tests,
reports on your terminal</li>
</ul>
</div>
<div class="slide" id="example-conftest-py-integrate-traditional-unittest-s">
<h1>Example conftest.py: integrate traditional unittest's</h1>
-<p><a class="reference" href="http://johnnydebris.net/svn/projects/py_unittest">http://johnnydebris.net/svn/projects/py_unittest</a></p>
-<p>contains a conftest that scans all found files for
-subclasses of unittest.TestCase and executes them</p>
-<p>XXX explore and summarize</p>
+<p><a class="reference" href="http://johnnydebris.net/svn/projects/py_unittest">http://johnnydebris.net/svn/projects/py_unittest</a>
+[courtesy Guido Wesdorp]</p>
+<ul class="simple">
+<li>additionally collect TestCase subclasses from
+all test_*.py Module and execute them</li>
+<li>allows to mix xUnit and py style tests</li>
+</ul>
</div>
<div class="slide" id="summary-extensions">
<h1>Summary extensions</h1>
<ul class="simple">
-<li>conftest.py's can be re-used per-project</li>
-<li>can add new (non-python) test items</li>
+<li>conftest.py files are supposed to be "drop in" plugins</li>
+<li>you can extend and modify the collection process</li>
+<li>you can add new (non-python) test items</li>
<li>if you use the above conftest.py's or have some of your own
please subscribe <a class="reference" href="http://codespeak.net/mailman/listinfo/py-dev">http://codespeak.net/mailman/listinfo/py-dev</a></li>
</ul>
Modified: py/extradoc/talk/ep2008/pytest.txt
==============================================================================
--- py/extradoc/talk/ep2008/pytest.txt (original)
+++ py/extradoc/talk/ep2008/pytest.txt Sat Jul 5 08:30:19 2008
@@ -204,7 +204,6 @@
tests and reports outcomes.
Collection Nodes ("py.test.collect.*"):
-XXX insert links?
**Directory**: collect files
@@ -230,6 +229,20 @@
**dynamic lookup of Collector/Item class from conftest.py files**
+Example conftest.py: control traversal
+===================================================
+
+a conftest.py to influence collection::
+
+ import py
+ mydir = py.magic.autopath().dirpath()
+ class Directory(py.test.collect.Directory):
+ def run(self):
+ if self.fspath == mydir:
+ return ["x", "y", "z"]
+ return super(Directory, self).run()
+
+
Example conftest.py: add ReST check support
==============================================
@@ -244,6 +257,7 @@
===========================================
http://codespeak.net/svn/user/arigo/hack/misc/htmlconftest
+[courtesy Armin Rigo]
- creates html output with "clickable" failures
- creates a nice historic view on test failures
@@ -255,25 +269,30 @@
======================================
http://codespeak.net/svn/user/cfbolz/jitpl/dist/test/conftest.py
+[courtesy Armin Rigo, Carl Friedrich Bolz]
- creates PrologTest items
- collects items and runs them through Prolog interpreter
-Example conftest.py: run javascript tests (in a browser)
+Example conftest.py: run Javascript tests
=========================================================
http://johnnydebris.net/svn/projects/jsbase
+[courtesy Guido Wesdorp]
-XXX explore and summarize
+- collects Javascript tests
+- sends them for execution to Spidermonkey JS interpreter
Example conftest.py: cross-platform testing
=============================================
+[courtesy Holger Krekel]
+
- goal: remotely run tests on windows
- check out py/misc/conftest-socketgatewayrun.py
-- requires one small script on the windows side
+- requires a small server script on the windows side
- transfers your source code to windows, runs tests,
reports on your terminal
@@ -282,19 +301,20 @@
=========================================================
http://johnnydebris.net/svn/projects/py_unittest
+[courtesy Guido Wesdorp]
-contains a conftest that scans all found files for
-subclasses of unittest.TestCase and executes them
-
-XXX explore and summarize
+- additionally collect TestCase subclasses from
+ all test_*.py Module and execute them
+- allows to mix xUnit and py style tests
Summary extensions
========================
-- conftest.py's can be re-used per-project
-- can add new (non-python) test items
+- conftest.py files are supposed to be "drop in" plugins
+- you can extend and modify the collection process
+- you can add new (non-python) test items
- if you use the above conftest.py's or have some of your own
please subscribe http://codespeak.net/mailman/listinfo/py-dev
More information about the pytest-commit
mailing list