Fix fixture example and regendocs (#5651)
Fix fixture example and regendocs
This commit is contained in:
commit
2a724a1c81
|
@ -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
|
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
|
cachedir: $PYTHON_PREFIX/.pytest_cache
|
||||||
rootdir: $REGENDOC_TMPDIR
|
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[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_2+4] PASSED [ 66%]
|
||||||
test_pytest_param_example.py::test_eval[basic_6*9] XFAIL [100%]
|
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:
|
As the result:
|
||||||
|
|
||||||
|
|
|
@ -391,7 +391,12 @@ close all resources created by a fixture even if one of them fails to be created
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from .utils import connect
|
|
||||||
|
@contextlib.contextmanager
|
||||||
|
def connect(port):
|
||||||
|
... # create connection
|
||||||
|
yield
|
||||||
|
... # close connection
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
|
@ -441,7 +446,12 @@ Here's the ``equipments`` fixture changed to use ``addfinalizer`` for cleanup:
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from .utils import connect
|
|
||||||
|
@contextlib.contextmanager
|
||||||
|
def connect(port):
|
||||||
|
... # create connection
|
||||||
|
yield
|
||||||
|
... # close connection
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
|
|
Loading…
Reference in New Issue