fix up install docs and plugin docs for the final release
have CHANGELOG be a file containing links instead of a symlink beause it causes issues with pip-install on some systems. --HG-- branch : trunk
This commit is contained in:
@@ -65,6 +65,15 @@ The order in which marker functions are called is this::
|
||||
Later called markers may overwrite previous key-value settings.
|
||||
Positional arguments are all appended to the same 'args' list
|
||||
of the Marker object.
|
||||
|
||||
Using "-k MARKNAME" to select tests
|
||||
----------------------------------------------------
|
||||
|
||||
You can use the ``-k`` command line option to select
|
||||
tests::
|
||||
|
||||
py.test -k webtest # will only run tests marked as webtest
|
||||
|
||||
"""
|
||||
import py
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ advanced skipping for python test functions, classes or modules.
|
||||
|
||||
With this plugin you can mark test functions for conditional skipping
|
||||
or as "xfail", expected-to-fail. Skipping a test will avoid running it
|
||||
while xfail-marked tests will run and result in an inverted outcome:
|
||||
at all while xfail-marked tests will run and result in an inverted outcome:
|
||||
a pass becomes a failure and a fail becomes a semi-passing one.
|
||||
|
||||
The need for skipping a test is usually connected to a condition.
|
||||
@@ -16,29 +16,37 @@ at the end of a test run.
|
||||
|
||||
.. _skipif:
|
||||
|
||||
mark a test function to be skipped
|
||||
Skipping a single function
|
||||
-------------------------------------------
|
||||
|
||||
Here is an example for skipping a test function when
|
||||
running on Python3::
|
||||
Here is an example for marking a test function to be skipped
|
||||
when run on a Python3 interpreter::
|
||||
|
||||
@py.test.mark.skipif("sys.version_info >= (3,0)")
|
||||
def test_function():
|
||||
...
|
||||
|
||||
|
||||
During test function setup the skipif condition is
|
||||
evaluated by calling ``eval(expr, namespace)``. The namespace
|
||||
contains the ``sys`` and ``os`` modules as well as the
|
||||
test ``config`` object. The latter allows you to skip based
|
||||
contains the ``sys`` and ``os`` modules and the test
|
||||
``config`` object. The latter allows you to skip based
|
||||
on a test configuration value e.g. like this::
|
||||
|
||||
@py.test.mark.skipif("not config.getvalue('db')")
|
||||
def test_function(...):
|
||||
...
|
||||
|
||||
Create a shortcut for your conditional skip decorator
|
||||
at module level like this::
|
||||
|
||||
mark many test functions at once
|
||||
win32only = py.test.mark.skipif("sys.platform != 'win32'")
|
||||
|
||||
@win32only
|
||||
def test_function():
|
||||
...
|
||||
|
||||
|
||||
skip groups of test functions
|
||||
--------------------------------------
|
||||
|
||||
As with all metadata function marking you can do it at
|
||||
@@ -52,11 +60,12 @@ for skipping all methods of a test class based on platform::
|
||||
# will not be setup or run under 'win32' platform
|
||||
#
|
||||
|
||||
The ``pytestmark`` decorator will be applied to each test function.
|
||||
|
||||
.. _`whole class- or module level`: mark.html#scoped-marking
|
||||
|
||||
|
||||
mark a test function as expected to fail
|
||||
mark a test function as **expected to fail**
|
||||
-------------------------------------------------------
|
||||
|
||||
You can use the ``xfail`` marker to indicate that you
|
||||
@@ -73,7 +82,7 @@ when it fails. Instead terminal reporting will list it in the
|
||||
Same as with skipif_ you can also selectively expect a failure
|
||||
depending on platform::
|
||||
|
||||
@py.test.mark.xfail(if"sys.version_info >= (3,0)")
|
||||
@py.test.mark.xfail("sys.version_info >= (3,0)")
|
||||
|
||||
def test_function():
|
||||
...
|
||||
|
||||
Reference in New Issue
Block a user