Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating markers example to newest pytest version #4557

Merged
merged 3 commits into from
Dec 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/4557.doc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Markers example documentation page updated to support latest pytest version.
11 changes: 1 addition & 10 deletions doc/en/example/markers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ apply a marker to an individual test instance::
@pytest.mark.foo
@pytest.mark.parametrize(("n", "expected"), [
(1, 2),
pytest.mark.bar((1, 3)),
pytest.param((1, 3), marks=pytest.mark.bar),
(2, 3),
])
def test_increment(n, expected):
Expand All @@ -318,15 +318,6 @@ In this example the mark "foo" will apply to each of the three
tests, whereas the "bar" mark is only applied to the second test.
Skip and xfail marks can also be applied in this way, see :ref:`skip/xfail with parametrize`.

.. note::

If the data you are parametrizing happen to be single callables, you need to be careful
when marking these items. ``pytest.mark.xfail(my_func)`` won't work because it's also the
signature of a function being decorated. To resolve this ambiguity, you need to pass a
reason argument:
``pytest.mark.xfail(func_bar, reason="Issue#7")``.


.. _`adding a custom marker from a plugin`:

Custom marker and command line option to control test runs
Expand Down