# HG changeset patch -- Bitbucket.org # Project pytest # URL http://bitbucket.org/hpk42/pytest/overview # User holger krekel <hol...@merlinux.eu> # Date 1291628480 -3600 # Node ID 127ccc0c6fcb51eb3d316be26df808cc14a73bc9 # Parent 0016d19f02853b7b1f18bb170162e4ffb994fe1b add some docs and new projects
--- a/doc/capture.txt +++ b/doc/capture.txt @@ -12,6 +12,47 @@ attempts to read from it. This is impor test otherwise might lead to waiting for input - which is usually not desired when running automated tests. +.. _printdebugging: + +Using print statements for debugging +--------------------------------------------------- + +One primary benefit of the default capturing of stdout/stderr output +is that you can use print statements for debugging:: + + # content of test_module.py + + def setup_function(function): + print ("setting up %s" % function) + + def test_func1(): + assert True + + def test_func2(): + assert False + +and running this module will show you precisely the output +of the failing function and hide the other one:: + + $ py.test + =========================== test session starts ============================ + platform linux2 -- Python 2.6.5 -- pytest-2.0.1.dev1 + collecting ... collected 2 items + + test_module.py .F + + ================================= FAILURES ================================= + ________________________________ test_func2 ________________________________ + + def test_func2(): + > assert False + E assert False + + test_module.py:9: AssertionError + ----------------------------- Captured stdout ------------------------------ + setting up <function test_func2 at 0x1e6cd70> + ==================== 1 failed, 1 passed in 0.04 seconds ==================== + Setting capturing methods or disabling capturing ------------------------------------------------- @@ -35,14 +76,6 @@ You can influence output capturing mecha py.test --capture=sys # replace sys.stdout/stderr with in-mem files py.test --capture=fd # also point filedescriptors 1 and 2 to temp file -If you set capturing values in a conftest file like this:: - - # conftest.py - option_capture = 'fd' - -then all tests in that directory will execute with "fd" style capturing. - -_ `printdebugging`: Accessing captured output from a test function --------------------------------------------------- --- a/tox.ini +++ b/tox.ini @@ -23,7 +23,7 @@ basepython=python2.7 deps=pytest-xdist commands= py.test -n3 -rfsxX \ - --junitxml={envlogdir}/junit-{envname}.xml [] + --ignore .tox --junitxml={envlogdir}/junit-{envname}.xml [] [testenv:trial] changedir=. @@ -68,7 +68,7 @@ commands= [pytest] minversion=2.0 plugins=pytester -addopts= -rxf --pyargs --doctest-modules +addopts= -rxf --pyargs --doctest-modules --ignore=.tox rsyncdirs=tox.ini pytest.py _pytest testing python_files=test_*.py *_test.py python_classes=Test Acceptance --- a/doc/projects.txt +++ b/doc/projects.txt @@ -3,18 +3,21 @@ Project examples ========================== -Here are some examples of projects using py.test: +Here are some examples of projects using py.test (please send notes via :ref:`contact`): * `PyPy <http://pypy.org>`_, Python with a JIT compiler, running over `16000 tests <http://test.pypy.org>`_ * the `MoinMoin <http://moinmo.in>`_ Wiki Engine * `tox <http://codespeak.net/tox>`_, virtualenv/Hudson integration tool * `PIDA <http://pida.co.uk>`_ framework for integrated development +* `PyPM <http://code.activestate.com/pypm/>`_ ActiveState's package manager * `Fom <http://packages.python.org/Fom/>`_ a fluid object mapper for FluidDB +* `applib <https://github.com/ActiveState/applib>`_ cross-platform utilities * `six <http://pypi.python.org/pypi/six/>`_ Python 2 and 3 compatibility utilities * `pediapress <http://code.pediapress.com/wiki/wiki>`_ MediaWiki articles * `mwlib <http://pypi.python.org/pypi/mwlib>`_ mediawiki parser and utility library * `The Translate Toolkit <http://translate.sourceforge.net/wiki/toolkit/index>`_ for localization and conversion * `execnet <http://codespeak.net/execnet>`_ rapid multi-Python deployment +* `pylib <http://pylib.org>`_ cross-platform path, IO, dynamic code library * `Pacha <http://pacha.cafepais.com/>`_ configuration management in five minutes * `bbfreeze <http://pypi.python.org/pypi/bbfreeze>`_ create standalone executables from Python scripts * `pdb++ <http://bitbucket.org/antocuni/pdb>`_ a fancier version of PDB @@ -34,15 +37,15 @@ Here are some examples of projects using * `bu <http://packages.python.org/bu/>`_ a microscopic build system * `katcp <https://bitbucket.org/hodgestar/katcp>`_ Telescope communication protocol over Twisted * `kss plugin timer <http://pypi.python.org/pypi/kss.plugin.timer>`_ -* many more ... (please send notes via the :ref:`contact`) Some organisations using py.test ----------------------------------- -* `Square Kilometre Array <http://ska.ac.za/>`_ +* `Square Kilometre Array, Cape Town <http://ska.ac.za/>`_ * `Tandberg <http://www.tandberg.com/>`_ -* `Stups department of Heinrich Heine University <http://www.stups.uni-duesseldorf.de/projects.php>`_ -* `Open End <http://openend.se>`_ -* `Laboraratory of Bioinformatics <http://genesilico.pl/>`_ -* `merlinux <http://merlinux.eu>`_ +* `Shootq <http://web.shootq.com/>`_ +* `Stups department of Heinrich Heine University Düsseldorf <http://www.stups.uni-duesseldorf.de/projects.php>`_ +* `Open End, Gotenborg <http://www.openend.se>`_ +* `Laboraratory of Bioinformatics, Warsaw <http://genesilico.pl/>`_ +* `merlinux, Germany <http://merlinux.eu>`_ * many more ... (please be so kind to send a note via :ref:`contact`) --- a/doc/index.txt +++ b/doc/index.txt @@ -8,7 +8,7 @@ Welcome to ``py.test``! - runs on Posix/Windows, Python 2.4-3.2, PyPy and Jython - continously `tested on many Python interpreters <http://hudson.testrun.org/view/pytest/job/pytest/>`_ - - used in :ref:`many projects <projects>`, ranging from 10 to 10000 tests + - used in :ref:`many projects and organisations <projects>`, ranging from 10 to 10000 tests - has :ref:`comprehensive documentation <toc>` - comes with :ref:`tested examples <examples>` - supports :ref:`good integration practises <goodpractises>` @@ -18,7 +18,8 @@ Welcome to ``py.test``! - makes it :ref:`easy to get started <getstarted>`, refined :ref:`usage options <usage>` - :ref:`assert with the assert statement` - helpful :ref:`traceback and failing assertion reporting <tbreportdemo>` - - allows `print debugging <printdebugging>`_ and `generic output capturing <captures>`_ + - allows :ref:`print debugging <printdebugging>` and :ref:`generic output + capturing <captures>` - supports :pep:`8` compliant coding style in tests - **supports functional testing and complex test setups** --- a/doc/xdist.txt +++ b/doc/xdist.txt @@ -148,7 +148,7 @@ environment this command will send each platforms - and report back failures from all platforms at once. The specifications strings use the `xspec syntax`_. -.. _`xspec syntax`: http://codespeak.net/execnet/trunk/basics.html#xspec +.. _`xspec syntax`: http://codespeak.net/execnet/basics.html#xspec .. _`socketserver.py`: http://bitbucket.org/hpk42/execnet/raw/2af991418160/execnet/script/socketserver.py --- a/doc/contact.txt +++ b/doc/contact.txt @@ -15,7 +15,7 @@ Contact channels - #pylib on irc.freenode.net IRC channel for random questions. -- private mail to Holger.Krekel at gmail com if you have sensitive issues to communicate +- private mail to Holger.Krekel at gmail com if you want to communicate sensitive issues - `commit mailing list`_
_______________________________________________ py-svn mailing list py-svn@codespeak.net http://codespeak.net/mailman/listinfo/py-svn