Remove references to python pre-2.6 from docs

This commit is contained in:
Bruno Oliveira 2015-12-16 16:14:36 -02:00
parent 81588d7f63
commit ec597e81a4
7 changed files with 16 additions and 34 deletions

View File

@ -243,10 +243,9 @@ recording the intermediate values. Which technique is used depends on the
location of the assert, ``pytest`` configuration, and Python version being used location of the assert, ``pytest`` configuration, and Python version being used
to run ``pytest``. to run ``pytest``.
By default, if the Python version is greater than or equal to 2.6, ``pytest`` By default, ``pytest`` rewrites assert statements in test modules.
rewrites assert statements in test modules. Rewritten assert statements put Rewritten assert statements put introspection information into the assertion failure message.
introspection information into the assertion failure message. ``pytest`` only ``pytest`` only rewrites test modules directly discovered by its test collection process, so
rewrites test modules directly discovered by its test collection process, so
asserts in supporting modules which are not themselves test modules will not be asserts in supporting modules which are not themselves test modules will not be
rewritten. rewritten.

View File

@ -234,8 +234,8 @@ For an example on how to add and work with markers from a plugin, see
Marking whole classes or modules Marking whole classes or modules
---------------------------------------------------- ----------------------------------------------------
If you are programming with Python 2.6 or later you may use ``pytest.mark`` You may use ``pytest.mark`` decorators with classes to apply markers to all of
decorators with classes to apply markers to all of its test methods:: its test methods::
# content of test_mark_classlevel.py # content of test_mark_classlevel.py
import pytest import pytest

View File

@ -66,9 +66,8 @@ This completely avoids previous issues of confusing assertion-reporting.
It also means, that you can use Python's ``-O`` optimization without losing It also means, that you can use Python's ``-O`` optimization without losing
assertions in test modules. assertions in test modules.
``pytest`` contains a second, mostly obsolete, assert debugging technique, ``pytest`` contains a second, mostly obsolete, assert debugging technique
invoked via ``--assert=reinterpret``, activated by default on invoked via ``--assert=reinterpret``: When an ``assert`` statement fails, ``pytest`` re-interprets
Python-2.5: When an ``assert`` statement fails, ``pytest`` re-interprets
the expression part to show intermediate values. This technique suffers the expression part to show intermediate values. This technique suffers
from a caveat that the rewriting does not: If your expression has side from a caveat that the rewriting does not: If your expression has side
effects (better to avoid them anyway!) the intermediate values may not effects (better to avoid them anyway!) the intermediate values may not

View File

@ -89,9 +89,7 @@ between test modules so it's no longer advertised as the primary method.
Skip all test functions of a class or module Skip all test functions of a class or module
--------------------------------------------- ---------------------------------------------
As with all function :ref:`marking <mark>` you can skip test functions at the You can use the ``skipif`` decorator (and any other marker) on classes::
`whole class- or module level`_. If your code targets python2.6 or above you
use the skipif decorator (and any other marker) on classes::
@pytest.mark.skipif(sys.platform == 'win32', @pytest.mark.skipif(sys.platform == 'win32',
reason="does not run on windows") reason="does not run on windows")
@ -103,19 +101,6 @@ use the skipif decorator (and any other marker) on classes::
If the condition is true, this marker will produce a skip result for If the condition is true, this marker will produce a skip result for
each of the test methods. each of the test methods.
If your code targets python2.5 where class-decorators are not available,
you can set the ``pytestmark`` attribute of a class::
class TestPosixCalls:
pytestmark = pytest.mark.skipif(sys.platform == 'win32',
reason="does not run on windows")
def test_function(self):
"will not be setup or run under 'win32' platform"
As with the class-decorator, the ``pytestmark`` special name tells
``pytest`` to apply it to each test function in the class.
If you want to skip all test functions of a module, you must use If you want to skip all test functions of a module, you must use
the ``pytestmark`` name on the global level: the ``pytestmark`` name on the global level:

View File

@ -126,7 +126,7 @@ Specifying test exec environments in a conftest.py
Instead of specifying command line options, you can Instead of specifying command line options, you can
put options values in a ``conftest.py`` file like this:: put options values in a ``conftest.py`` file like this::
option_tx = ['ssh=myhost//python=python2.5', 'popen//python=python2.5'] option_tx = ['ssh=myhost//python=python2.7', 'popen//python=python2.7']
option_dist = True option_dist = True
Any commandline ``--tx`` specifications will add to the list of Any commandline ``--tx`` specifications will add to the list of
@ -163,7 +163,7 @@ command line options
(default) no: run tests inprocess, don't distribute. (default) no: run tests inprocess, don't distribute.
``--tx=xspec`` ``--tx=xspec``
add a test execution environment. some examples: --tx popen//python=python2.5 --tx socket=192.168.1.102:8888 --tx ssh=user@codespeak.net//chdir=testcache add a test execution environment. some examples: --tx popen//python=python2.7 --tx socket=192.168.1.102:8888 --tx ssh=user@codespeak.net//chdir=testcache
``-d`` ``-d``
load-balance tests. shortcut for '--dist=load' load-balance tests. shortcut for '--dist=load'
``--rsyncdir=dir1`` ``--rsyncdir=dir1``

View File

@ -12,8 +12,7 @@ Calling pytest through ``python -m pytest``
.. versionadded:: 2.0 .. versionadded:: 2.0
If you use Python-2.5 or later you can invoke testing through the You can invoke testing through the Python interpreter from the command line::
Python interpreter from the command line::
python -m pytest [...] python -m pytest [...]

View File

@ -61,16 +61,16 @@ a lot of I/O this can lead to considerable speed ups.
Running tests in a Python subprocess Running tests in a Python subprocess
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
To instantiate a Python-2.4 subprocess and send tests to it, you may type:: To instantiate a Python-2.7 subprocess and send tests to it, you may type::
py.test -d --tx popen//python=python2.4 py.test -d --tx popen//python=python2.7
This will start a subprocess which is run with the "python2.4" This will start a subprocess which is run with the "python2.7"
Python interpreter, found in your system binary lookup path. Python interpreter, found in your system binary lookup path.
If you prefix the --tx option value like this:: If you prefix the --tx option value like this::
py.test -d --tx 3*popen//python=python2.4 py.test -d --tx 3*popen//python=python2.7
then three subprocesses would be created and the tests then three subprocesses would be created and the tests
will be distributed to three subprocesses and run simultanously. will be distributed to three subprocesses and run simultanously.
@ -170,7 +170,7 @@ For example, you could make running with three subprocesses your default::
You can also add default environments like this:: You can also add default environments like this::
[pytest] [pytest]
addopts = --tx ssh=myhost//python=python2.5 --tx ssh=myhost//python=python2.6 addopts = --tx ssh=myhost//python=python2.7 --tx ssh=myhost//python=python2.6
and then just type:: and then just type::