From 752965c29866011a99387d13041ca002fc660e65 Mon Sep 17 00:00:00 2001 From: holger krekel Date: Mon, 6 Dec 2010 10:41:20 +0100 Subject: [PATCH] add some docs and new projects --- doc/capture.txt | 49 ++++++++++++++++++++++++++++++++++++++++-------- doc/contact.txt | 2 +- doc/index.txt | 5 +++-- doc/projects.txt | 17 ++++++++++------- doc/xdist.txt | 2 +- tox.ini | 4 ++-- 6 files changed, 58 insertions(+), 21 deletions(-) diff --git a/doc/capture.txt b/doc/capture.txt index ebb1d7056..fc257272e 100644 --- a/doc/capture.txt +++ b/doc/capture.txt @@ -12,6 +12,47 @@ attempts to read from it. This is important if some code paths in 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 + ==================== 1 failed, 1 passed in 0.04 seconds ==================== + Setting capturing methods or disabling capturing ------------------------------------------------- @@ -35,14 +76,6 @@ You can influence output capturing mechanisms from the command line:: 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 --------------------------------------------------- diff --git a/doc/contact.txt b/doc/contact.txt index 69c13185f..0a8796b01 100644 --- 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`_ diff --git a/doc/index.txt b/doc/index.txt index 8d5a57072..0f20853b3 100644 --- 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 `_ - - used in :ref:`many projects `, ranging from 10 to 10000 tests + - used in :ref:`many projects and organisations `, ranging from 10 to 10000 tests - has :ref:`comprehensive documentation ` - comes with :ref:`tested examples ` - supports :ref:`good integration practises ` @@ -18,7 +18,8 @@ Welcome to ``py.test``! - makes it :ref:`easy to get started `, refined :ref:`usage options ` - :ref:`assert with the assert statement` - helpful :ref:`traceback and failing assertion reporting ` - - allows `print debugging `_ and `generic output capturing `_ + - allows :ref:`print debugging ` and :ref:`generic output + capturing ` - supports :pep:`8` compliant coding style in tests - **supports functional testing and complex test setups** diff --git a/doc/projects.txt b/doc/projects.txt index 4804ffe84..1502ebbcd 100644 --- 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 `_, Python with a JIT compiler, running over `16000 tests `_ * the `MoinMoin `_ Wiki Engine * `tox `_, virtualenv/Hudson integration tool * `PIDA `_ framework for integrated development +* `PyPM `_ ActiveState's package manager * `Fom `_ a fluid object mapper for FluidDB +* `applib `_ cross-platform utilities * `six `_ Python 2 and 3 compatibility utilities * `pediapress `_ MediaWiki articles * `mwlib `_ mediawiki parser and utility library * `The Translate Toolkit `_ for localization and conversion * `execnet `_ rapid multi-Python deployment +* `pylib `_ cross-platform path, IO, dynamic code library * `Pacha `_ configuration management in five minutes * `bbfreeze `_ create standalone executables from Python scripts * `pdb++ `_ a fancier version of PDB @@ -34,15 +37,15 @@ Here are some examples of projects using py.test: * `bu `_ a microscopic build system * `katcp `_ Telescope communication protocol over Twisted * `kss plugin timer `_ -* many more ... (please send notes via the :ref:`contact`) Some organisations using py.test ----------------------------------- -* `Square Kilometre Array `_ +* `Square Kilometre Array, Cape Town `_ * `Tandberg `_ -* `Stups department of Heinrich Heine University `_ -* `Open End `_ -* `Laboraratory of Bioinformatics `_ -* `merlinux `_ +* `Shootq `_ +* `Stups department of Heinrich Heine University Düsseldorf `_ +* `Open End, Gotenborg `_ +* `Laboraratory of Bioinformatics, Warsaw `_ +* `merlinux, Germany `_ * many more ... (please be so kind to send a note via :ref:`contact`) diff --git a/doc/xdist.txt b/doc/xdist.txt index 3bb4a3ea2..9375a6e5d 100644 --- a/doc/xdist.txt +++ b/doc/xdist.txt @@ -148,7 +148,7 @@ environment this command will send each tests to all 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 diff --git a/tox.ini b/tox.ini index 4777b51c3..3854d398b 100644 --- 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