From 60773e0a97d4ff37f69e3ae01c9a03ee9a4b9120 Mon Sep 17 00:00:00 2001 From: Kanguros Date: Sun, 16 Dec 2018 21:13:14 +0100 Subject: [PATCH 1/3] Updating markers example to newest pytest version --- doc/en/example/markers.rst | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/doc/en/example/markers.rst b/doc/en/example/markers.rst index 8ab885f0f..019157bd9 100644 --- a/doc/en/example/markers.rst +++ b/doc/en/example/markers.rst @@ -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): @@ -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 From f04d3c8b7d49d8865c956f8ad2803a363f4f7108 Mon Sep 17 00:00:00 2001 From: Kanguros Date: Sun, 16 Dec 2018 21:27:59 +0100 Subject: [PATCH 2/3] Adding change log entry --- changelog/4557.doc.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog/4557.doc.rst diff --git a/changelog/4557.doc.rst b/changelog/4557.doc.rst new file mode 100644 index 000000000..72562788a --- /dev/null +++ b/changelog/4557.doc.rst @@ -0,0 +1 @@ +Markers example documentation page updated to support latest pytest version. \ No newline at end of file From 843d00c2193cd90d2ee752fa0a587f16a890d393 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Mon, 17 Dec 2018 10:35:17 -0200 Subject: [PATCH 3/3] Fix linting --- changelog/4557.doc.rst | 2 +- doc/en/example/markers.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/changelog/4557.doc.rst b/changelog/4557.doc.rst index 72562788a..dba2e39cd 100644 --- a/changelog/4557.doc.rst +++ b/changelog/4557.doc.rst @@ -1 +1 @@ -Markers example documentation page updated to support latest pytest version. \ No newline at end of file +Markers example documentation page updated to support latest pytest version. diff --git a/doc/en/example/markers.rst b/doc/en/example/markers.rst index 019157bd9..9d325c30e 100644 --- a/doc/en/example/markers.rst +++ b/doc/en/example/markers.rst @@ -308,7 +308,7 @@ apply a marker to an individual test instance:: @pytest.mark.foo @pytest.mark.parametrize(("n", "expected"), [ (1, 2), - pytest.param((1, 3), marks=pytest.mark.bar), + pytest.param((1, 3), marks=pytest.mark.bar), (2, 3), ]) def test_increment(n, expected):