extending and fixing docs about
- test config, funcargs - talks and tutorials --HG-- branch : 1.0.x
This commit is contained in:
parent
1f5d156ab3
commit
cd5ffcc605
|
@ -9,6 +9,11 @@ py.execnet
|
||||||
* asynchronously send and receive data between processes through channels
|
* asynchronously send and receive data between processes through channels
|
||||||
* completely avoid manual installation steps on remote places
|
* 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
|
Gateways: immediately spawn local or remote process
|
||||||
===================================================
|
===================================================
|
||||||
|
|
||||||
|
|
|
@ -68,25 +68,28 @@ home-directoray, per shell session or per test-run.
|
||||||
|
|
||||||
.. _`basetemp`:
|
.. _`basetemp`:
|
||||||
|
|
||||||
per-testrun temporary directories
|
Temporary directories
|
||||||
-------------------------------------------
|
-------------------------------------------
|
||||||
|
|
||||||
``py.test`` runs provide means to create per-test session
|
``py.test`` runs provide means to create per-test session
|
||||||
temporary (sub) directories through the config object.
|
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
|
tempdirs are created as sub directories of a per-session testdir
|
||||||
basetemp = py.test.config.ensuretemp()
|
|
||||||
basetemp_subdir = py.test.config.ensuretemp("subdir")
|
|
||||||
|
|
||||||
By default, ``py.test`` creates a ``pytest-NUMBER`` directory
|
|
||||||
and will keep around the directories of the last three
|
and will keep around the directories of the last three
|
||||||
test runs. You can also set the base temporary directory
|
test runs. You can also set the base temporary directory
|
||||||
with the `--basetemp`` option. When distributing
|
with the `--basetemp`` option. When distributing
|
||||||
tests on the same machine, ``py.test`` takes care to
|
tests on the same machine, ``py.test`` takes care to
|
||||||
pass around the basetemp directory such that all temporary
|
pass around the basetemp directory such that all temporary
|
||||||
files land below the same basetemp directory.
|
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
|
||||||
|
|
|
@ -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,
|
Since version 1.0 py.test introduces test function arguments,
|
||||||
in short "funcargs" for your Python test functions. The basic idea
|
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.
|
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
|
.. sourcecode:: python
|
||||||
|
|
||||||
def pytest_funcarg__db(request):
|
def pytest_funcarg__db(request):
|
||||||
return request.cached_setup(
|
return request.cached_setup(
|
||||||
lambda: ExpensiveSetup(request.config.option.db),
|
setup=lambda: ExpensiveSetup(request.config.option.db),
|
||||||
lambda val: val.close(),
|
teardown=lambda val: val.close(),
|
||||||
scope="run"
|
scope="session"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -50,10 +50,12 @@ Python test module is inspected for test methods starting with ``test_``.
|
||||||
.. Organising your tests
|
.. 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
|
.. _download: ../download.html
|
||||||
.. _features: features.html
|
.. _features: features.html
|
||||||
|
.. _tutorials: talks.html
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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
|
|
@ -17,8 +17,11 @@ funcargs_: powerful parametrized test function setup
|
||||||
|
|
||||||
extend_: intro to extend and customize py.test runs
|
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
|
.. _quickstart: quickstart.html
|
||||||
.. _features: features.html
|
.. _features: features.html
|
||||||
.. _funcargs: funcargs.html
|
.. _funcargs: funcargs.html
|
||||||
|
|
Loading…
Reference in New Issue