From cd5ffcc60560b81f560366422cc04609af3211d5 Mon Sep 17 00:00:00 2001 From: holger krekel Date: Sat, 4 Jul 2009 15:14:14 +0100 Subject: [PATCH] extending and fixing docs about - test config, funcargs - talks and tutorials --HG-- branch : 1.0.x --- doc/execnet.txt | 5 +++++ doc/test/config.txt | 21 ++++++++++++--------- doc/test/funcargs.txt | 14 +++++++------- doc/test/quickstart.txt | 6 ++++-- doc/test/talks.txt | 26 ++++++++++++++++++++++++++ doc/test/test.txt | 5 ++++- 6 files changed, 58 insertions(+), 19 deletions(-) create mode 100644 doc/test/talks.txt diff --git a/doc/execnet.txt b/doc/execnet.txt index 9a013dff8..1d1373654 100644 --- a/doc/execnet.txt +++ b/doc/execnet.txt @@ -9,6 +9,11 @@ py.execnet * asynchronously send and receive data between processes through channels * completely avoid manual installation steps on remote places +There is a `EuroPython2009 talk`_ from July 2009 with +examples and some pictures. + +.. _`EuroPython2009 talk`: http://codespeak.net/download/py/ep2009-execnet.pdf + Gateways: immediately spawn local or remote process =================================================== diff --git a/doc/test/config.txt b/doc/test/config.txt index 264549f18..18f5c253b 100644 --- a/doc/test/config.txt +++ b/doc/test/config.txt @@ -68,25 +68,28 @@ home-directoray, per shell session or per test-run. .. _`basetemp`: -per-testrun temporary directories +Temporary directories ------------------------------------------- ``py.test`` runs provide means to create per-test session temporary (sub) directories through the config object. -You can create directories like this: +You can create directories by calling a method +on the config object: -.. XXX use a more local example, just with "config" +- ``config.mktemp(basename)``: create and returns a new tempdir -.. sourcecode: python +- ``config.ensuretemp(basename)``: create or return a new tempdir - import py - basetemp = py.test.config.ensuretemp() - basetemp_subdir = py.test.config.ensuretemp("subdir") - -By default, ``py.test`` creates a ``pytest-NUMBER`` directory +tempdirs are created as sub directories of a per-session testdir and will keep around the directories of the last three test runs. You can also set the base temporary directory with the `--basetemp`` option. When distributing tests on the same machine, ``py.test`` takes care to pass around the basetemp directory such that all temporary files land below the same basetemp directory. + +The config object is available when implementing `function arguments`_ +or `extensions`_ and can otherwise be globally accessed as ``py.test.config``. + +.. _`function arguments`: funcargs.html +.. _`extensions`: extend.html diff --git a/doc/test/funcargs.txt b/doc/test/funcargs.txt index 45cdb137b..18228e0ff 100644 --- a/doc/test/funcargs.txt +++ b/doc/test/funcargs.txt @@ -1,6 +1,6 @@ -====================================================== -**funcargs**: test setup and parametrization -====================================================== +========================================================== +**funcargs**: pythonic test setup and parametrization +========================================================== Since version 1.0 py.test introduces test function arguments, in short "funcargs" for your Python test functions. The basic idea @@ -156,15 +156,15 @@ perform scope-specific setup and cleanup scope == 'session': when tests of the session have run. """ -example for providing a value that is to be setup only once during a test run: +example for providing a value that is to be setup only once during a test session: .. sourcecode:: python def pytest_funcarg__db(request): return request.cached_setup( - lambda: ExpensiveSetup(request.config.option.db), - lambda val: val.close(), - scope="run" + setup=lambda: ExpensiveSetup(request.config.option.db), + teardown=lambda val: val.close(), + scope="session" ) diff --git a/doc/test/quickstart.txt b/doc/test/quickstart.txt index 84a30d5a2..66db2f069 100644 --- a/doc/test/quickstart.txt +++ b/doc/test/quickstart.txt @@ -50,10 +50,12 @@ Python test module is inspected for test methods starting with ``test_``. .. Organising your tests .. --------------------------- -Please refer to `features`_ for a walk through the basic features. - +Please refer to `features`_ for a walk through the basic features +or checkout the `tutorials`_ page for more introduction material. .. _download: ../download.html .. _features: features.html +.. _tutorials: talks.html + diff --git a/doc/test/talks.txt b/doc/test/talks.txt new file mode 100644 index 000000000..390065957 --- /dev/null +++ b/doc/test/talks.txt @@ -0,0 +1,26 @@ +========================== +Talks and Tutorials +========================== + +.. _`funcargs`: funcargs.html + +a list of the latest talk and tutorial material: + +- `ep2009-rapidtesting.pdf`_ tutorial slides (July 2009): + + - testing terminology + - basic py.test usage, file system layout + - test function arguments (funcargs_) and test fixtures + - existing plugins + - distributed testing + +- `ep2009-pytest.pdf`_ 60 minute py.test talk, highlighting unique features and a roadmap (July 2009) + +- `pycon2009-pytest-introduction.zip`_ slides and files, extended version of py.test basic introduction, discusses more options, also introduces old-style xUnit setup, looponfailing and other features. + +- `pycon2009-pytest-advanced.pdf`_ contain a slightly older version of funcargs and distributed testing, compared to the EuroPython 2009 slides. + +.. _`ep2009-rapidtesting.pdf`: http://codespeak.net/download/py/ep2009-rapidtesting.pdf +.. _`ep2009-pytest.pdf`: http://codespeak.net/download/py/ep2009-pytest.pdf +.. _`pycon2009-pytest-introduction.zip`: http://codespeak.net/download/py/pycon2009-pytest-introduction.zip +.. _`pycon2009-pytest-advanced.pdf`: http://codespeak.net/download/py/pycon2009-pytest-advanced.pdf diff --git a/doc/test/test.txt b/doc/test/test.txt index 78183d200..27c491743 100644 --- a/doc/test/test.txt +++ b/doc/test/test.txt @@ -17,8 +17,11 @@ funcargs_: powerful parametrized test function setup extend_: intro to extend and customize py.test runs -config_: ``conftest.py`` files and general configuration +config_: ``conftest.py`` files and the config object +talks_: talk and tutorial slides + +.. _talks: talks.html .. _quickstart: quickstart.html .. _features: features.html .. _funcargs: funcargs.html