Fix fixture example and regendocs (#5651)

Fix fixture example and regendocs
This commit is contained in:
Bruno Oliveira 2019-07-23 11:53:13 -03:00 committed by GitHub
commit 2a724a1c81
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 4 deletions

View File

@ -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:

View File

@ -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