* add a script for generating plugin docs

* improve generation of docs
* refine plugins docs

--HG--
branch : 1.0.x
This commit is contained in:
holger krekel
2009-07-14 21:17:13 +02:00
parent cd0972ede8
commit 013381fae1
14 changed files with 340 additions and 163 deletions
+8 -8
View File
@@ -173,20 +173,20 @@ class Project:
stylesheet=stylesheet, encoding=encoding)
content = strip_html_header(content, encoding=encoding)
page = self.Page(self, "[%s] " % txtpath.purebasename,
title = "[%s] %s" % (txtpath.purebasename, py.version)
page = self.Page(self, title,
outputpath, stylesheeturl=stylesheet)
try:
svninfo = txtpath.info()
modified = " modified %s by %s" % (worded_time(svninfo.mtime),
getrealname(svninfo.last_author))
except (KeyboardInterrupt, SystemExit):
raise
except:
modified = py.process.cmdexec(
"hg tip --template 'last modified {date|shortdate}'"
)
except py.process.cmdexec.Error:
modified = " "
page.contentspace.append(
html.div(html.div(modified, style="float: right; font-style: italic;"),
html.div(html.div(modified,
style="float: right; font-style: italic;"),
id = 'docinfoline'))
page.contentspace.append(py.xml.raw(content))
+68 -60
View File
@@ -6,12 +6,11 @@ Downloading
Latest Release, see `PyPI project page`_
"easy_install py"
using setuptools / easy_install
===================================================
With a working `setuptools installation`_ you can type::
easy_install -U py
to get the latest release of the py lib. The ``-U`` switch
@@ -26,21 +25,77 @@ install the full py lib. If you don't have a compiler available
you can still install the py lib but without greenlets - look
below for the ``install_lib`` target.
**IMPORTANT NOTE**: if you are using Windows and have previous
installations of the py lib on your system, please download
**IMPORTANT NOTE**: if you are using Windows and have
0.8 versions of the py lib on your system, please download
and execute http://codespeak.net/svn/py/build/winpathclean.py
This will check that no previous files are getting in the way.
(Unfortunately we don't know about a way to execute this
code automatically during the above install).
You can find out the py lib version with::
Installing on Debian or Fedora
import py
print py.version
.. _`checkout`:
Installing from version control / develop mode
=================================================
To follow development or help with fixing things
for the next release, checkout the complete code
and documentation source with mercurial_::
hg clone https://bitbucket.org/hpk42/py-trunk/
With a working `setuptools installation`_ you can then issue::
python setup.py develop
in order to work with your checkout version.
.. _mercurial: http://mercurial.selenic.com/wiki/
Working without setuptools / from source
==========================================
If you have a checkout_ or a tarball_ it is actually not neccessary to issue
``setup.py`` commands in order to use py lib and its tools. You can
simply add the root directory to ``PYTHONPATH`` and ``py/bin`` or
``py\bin\win32`` to your ``PATH`` settings.
There are also helper scripts to set the environment
on windows::
c:\\path\to\checkout\py\env.cmd
and on linux/osx you can add something like this to
your shell initialization::
eval `python ~/path/to/checkout/py/env.py`
both of which which will get you good settings
for ``PYTHONPATH`` and ``PATH``.
Note also that the command line scripts will look
for "nearby" py libs, so if you have a layout like this::
mypkg/
subpkg1/
tests/
tests/
py/
then issuing ``py.test subpkg1`` will use the py lib
from that projects root directory.
Debian and RPM packages
===================================
As of July 2009 pytest/pylib 1.0 RPMs and Debian packages
are not yet available.
are not yet available. So you will only find older
versions.
On Debian systems look for ``python-codespeak-lib``.
*This package is probably outdated - if somebody
*But this package is probably outdated - if somebody
can help with bringing this up to date,
that would be very much appreciated.*
@@ -50,12 +105,14 @@ Dwayne Bailey has thankfully put together a Fedora `RPM`_.
.. _`setuptools installation`: http://pypi.python.org/pypi/setuptools
Downloading a tar/zip archive and installing that
.. _tarball:
Installing from a TAR archive
===================================================
You need a working `setuptools installation`_.
Go to the python package index (pypi) and download a tar or zip file:
Go to the python package index (pypi) and download a tar file:
http://pypi.python.org/pypi/py/
@@ -63,52 +120,3 @@ and unpack it to a directory, where you then type::
python setup.py install
Installing from subversion / develop mode
============================================
To follow development or help with fixing things
for the next release, checkout the complete code
and documentation source with mercurial::
hg clone https://bitbucket.org/hpk42/py-trunk/
or with subversion:
svn co http://codespeak.net/svn/py/trunk
With a working `setuptools installation`_ you can then issue::
python setup.py develop
in order to work with your checkout version.
Working with multiple py lib versions / svn externals
=======================================================
If you happen to have multiple versions of the py lib
around or you ship the py lib as an svn-external to
then you might want to use py lib scripts more directly.
For example if you have a project layout like this::
mypkg/
subpkg1/
tests/
tests/
py/ # as svn-external, could be specific tag/version
then you want to make sure that the actual local py lib is used
and not another system-wide version. For this you need to add
``py/bin`` or ``py\bin\win32`` respectively to your system's PATH settings.
You can do this by executing (on windows) a script to set the environment::
c:\\path\to\checkout\py\env.cmd
or on linux/osx you can add something like this to your shell
initialization::
eval `python ~/path/to/checkout/py/env.py`
to get good settings for PYTHONPATH and PATH.
-24
View File
@@ -39,27 +39,3 @@ Minor support functionality
.. _`py.xml`: xml.html
.. _`miscellaneous features`: misc.html
Full Contents
===================================
.. toctree::
:maxdepth: 2
test
execnet
path
code
bin
xml
io
log
misc
coding-style
contact
download
releases
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
+12 -9
View File
@@ -4,15 +4,18 @@ Extending and customizing py.test
.. _`local plugin`:
py.test implements much of its functionality by calling `well specified
hooks`_. Python modules which contain such hook functions are called
plugins. Hook functions are discovered in ``conftest.py`` files or
in **named** plugins. ``conftest.py`` files are sometimes called "anonymous"
or conftest plugins. They are useful for keeping test extensions close
to the application package. Named plugins are normal python modules or packages
that can be distributed separately. Named plugins need to follow a naming pattern;
they have an all lowercase ``pytest_`` prefixed name. While conftest plugins are
discovered automatically, named plugins must be explicitely specified.
py.test implements much of its functionality by calling `well specified
hooks`_. Python modules which contain such hook functions are called
plugins. Hook functions are discovered in ``conftest.py`` files or in
`named plugins`_. ``conftest.py`` files are sometimes called
"anonymous" or conftest plugins. They are useful for keeping test
extensions close to your application. Named plugins are normal python
modules or packages that can be distributed separately. Named plugins
need to follow a naming pattern; they have an all lowercase ``pytest_``
prefixed name. While conftest plugins are discovered automatically,
named plugins must be explicitely specified.
.. _`named plugins`: plugins.html
.. _`tool startup`:
.. _`test tool starts up`:
+3 -1
View File
@@ -292,7 +292,8 @@ To make it easier to distinguish the generated tests it is possible to specify a
easy to extend
=========================================
Since 1.0 py.test has advanced `extension mechanisms`_.
Since 1.0 py.test has advanced `extension mechanisms`_
and a growing `list of plugins`_.
One can can easily modify or add aspects for for
purposes such as:
@@ -301,6 +302,7 @@ purposes such as:
* running non-python tests
* managing custom test state setup
.. _`list of plugins`: plugins.html
.. _`extension mechanisms`: extend.html
.. _`reStructured Text`: http://docutils.sourceforge.net
+72
View File
@@ -0,0 +1,72 @@
=====================================================
Plugins related to Python test functions and programs
=====================================================
* `pytest_xfail`_ mark tests as expected-to-fail and report them separately.
* `pytest_figleaf`_ write and report coverage data with 'figleaf'.
* `pytest_monkeypatch`_ safely patch object attributes, dicts and environment variables.
* `pytest_iocapture`_ 'capsys' and 'capfd' funcargs for capturing stdout/stderror.
* `pytest_recwarn`_ helpers for asserting deprecation and other warnings.
==============================================
Plugins for other testing styles and languages
==============================================
* `pytest_unittest`_ automatically discover and run traditional "unittest.py" style tests.
* `pytest_doctest`_ collect and execute doctests from modules and test files.
* `pytest_restdoc`_ perform ReST syntax, local and remote reference tests on .rst/.txt files.
* `pytest_oejskit`_ Testing Javascript in real browsers
=================================================
Plugins for generic reporting and failure logging
=================================================
* `pytest_pocoo`_ submit failure information to paste.pocoo.org
* `pytest_resultlog`_ resultlog plugin for machine-readable logging of test results.
* `pytest_terminal`_ terminal reporting of the full testing process.
=====================================
internal plugins / core functionality
=====================================
* `pytest_pdb`_ interactive debugging with the Python Debugger.
* `pytest_keyword`_ py.test.mark / keyword plugin
* `pytest_hooklog`_ log invocations of extension hooks to a file.
* `pytest_runner`_ collect and run test items and create reports.
* `pytest_execnetcleanup`_ cleanup execnet gateways during test function runs.
* `pytest_pytester`_ funcargs and support code for testing py.test's own functionality.
.. _`pytest_xfail`: http://bitbucket.org/hpk42/py-trunk/src/tip/py/test/plugin/pytest_xfail.py
.. _`pytest_figleaf`: http://bitbucket.org/hpk42/py-trunk/src/tip/py/test/plugin/pytest_figleaf.py
.. _`pytest_monkeypatch`: http://bitbucket.org/hpk42/py-trunk/src/tip/py/test/plugin/pytest_monkeypatch.py
.. _`pytest_iocapture`: http://bitbucket.org/hpk42/py-trunk/src/tip/py/test/plugin/pytest_iocapture.py
.. _`pytest_recwarn`: http://bitbucket.org/hpk42/py-trunk/src/tip/py/test/plugin/pytest_recwarn.py
.. _`pytest_unittest`: http://bitbucket.org/hpk42/py-trunk/src/tip/py/test/plugin/pytest_unittest.py
.. _`pytest_doctest`: http://bitbucket.org/hpk42/py-trunk/src/tip/py/test/plugin/pytest_doctest.py
.. _`pytest_restdoc`: http://bitbucket.org/hpk42/py-trunk/src/tip/py/test/plugin/pytest_restdoc.py
.. _`pytest_oejskit`: http://bitbucket.org/pedronis/js-infrastructure/src/tip/pytest_jstests.py
.. _`pytest_pocoo`: http://bitbucket.org/hpk42/py-trunk/src/tip/py/test/plugin/pytest_pocoo.py
.. _`pytest_resultlog`: http://bitbucket.org/hpk42/py-trunk/src/tip/py/test/plugin/pytest_resultlog.py
.. _`pytest_terminal`: http://bitbucket.org/hpk42/py-trunk/src/tip/py/test/plugin/pytest_terminal.py
.. _`pytest_pdb`: http://bitbucket.org/hpk42/py-trunk/src/tip/py/test/plugin/pytest_pdb.py
.. _`pytest_keyword`: http://bitbucket.org/hpk42/py-trunk/src/tip/py/test/plugin/pytest_keyword.py
.. _`pytest_hooklog`: http://bitbucket.org/hpk42/py-trunk/src/tip/py/test/plugin/pytest_hooklog.py
.. _`pytest_runner`: http://bitbucket.org/hpk42/py-trunk/src/tip/py/test/plugin/pytest_runner.py
.. _`pytest_execnetcleanup`: http://bitbucket.org/hpk42/py-trunk/src/tip/py/test/plugin/pytest_execnetcleanup.py
.. _`pytest_pytester`: http://bitbucket.org/hpk42/py-trunk/src/tip/py/test/plugin/pytest_pytester.py
+3
View File
@@ -11,6 +11,8 @@ quickstart_: for getting started immediately.
features_: a walk through basic features and usage.
`available plugins`_: list of py.test plugins
funcargs_: powerful parametrized test function setup
`distributed testing`_: distribute test runs to other machines and platforms.
@@ -21,6 +23,7 @@ config_: ``conftest.py`` files and the config object
talks_: talk and tutorial slides
.. _`available plugins`: plugins.html
.. _talks: talks.html
.. _quickstart: quickstart.html
.. _features: features.html