From 1873dc6a8a2551550d1c3b77eae5746c94e30304 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Tue, 23 Jul 2019 09:42:05 -0400 Subject: [PATCH 1/2] Fix fixture example in docs --- doc/en/fixture.rst | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/doc/en/fixture.rst b/doc/en/fixture.rst index 42fe7cf3a..4bb88cb7b 100644 --- a/doc/en/fixture.rst +++ b/doc/en/fixture.rst @@ -391,7 +391,12 @@ close all resources created by a fixture even if one of them fails to be created import pytest - from .utils import connect + + @contextlib.contextmanager + def connect(port): + ... # create connection + yield + ... # close connection @pytest.fixture @@ -441,7 +446,12 @@ Here's the ``equipments`` fixture changed to use ``addfinalizer`` for cleanup: import pytest - from .utils import connect + + @contextlib.contextmanager + def connect(port): + ... # create connection + yield + ... # close connection @pytest.fixture From f163b37f6ab8729f78941ed53c7ced6f1cffe7e9 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Tue, 23 Jul 2019 10:00:35 -0400 Subject: [PATCH 2/2] Run regen --- doc/en/example/parametrize.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/en/example/parametrize.rst b/doc/en/example/parametrize.rst index 0a5ba8358..3dff2c559 100644 --- a/doc/en/example/parametrize.rst +++ b/doc/en/example/parametrize.rst @@ -552,13 +552,13 @@ Then run ``pytest`` with verbose mode and with only the ``basic`` marker: platform linux -- Python 3.x.y, pytest-5.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR - collecting ... collected 17 items / 14 deselected / 3 selected + collecting ... collected 18 items / 15 deselected / 3 selected test_pytest_param_example.py::test_eval[1+7-8] PASSED [ 33%] test_pytest_param_example.py::test_eval[basic_2+4] PASSED [ 66%] test_pytest_param_example.py::test_eval[basic_6*9] XFAIL [100%] - ============ 2 passed, 14 deselected, 1 xfailed in 0.12 seconds ============ + ============ 2 passed, 15 deselected, 1 xfailed in 0.12 seconds ============ As the result: