Skip to content

Commit 2a724a1

Browse files
authored
Fix fixture example and regendocs (#5651)
Fix fixture example and regendocs
2 parents 52ad5a1 + f163b37 commit 2a724a1

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

doc/en/example/parametrize.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -552,13 +552,13 @@ Then run ``pytest`` with verbose mode and with only the ``basic`` marker:
552552
platform linux -- Python 3.x.y, pytest-5.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python
553553
cachedir: $PYTHON_PREFIX/.pytest_cache
554554
rootdir: $REGENDOC_TMPDIR
555-
collecting ... collected 17 items / 14 deselected / 3 selected
555+
collecting ... collected 18 items / 15 deselected / 3 selected
556556
557557
test_pytest_param_example.py::test_eval[1+7-8] PASSED [ 33%]
558558
test_pytest_param_example.py::test_eval[basic_2+4] PASSED [ 66%]
559559
test_pytest_param_example.py::test_eval[basic_6*9] XFAIL [100%]
560560
561-
============ 2 passed, 14 deselected, 1 xfailed in 0.12 seconds ============
561+
============ 2 passed, 15 deselected, 1 xfailed in 0.12 seconds ============
562562
563563
As the result:
564564

doc/en/fixture.rst

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,12 @@ close all resources created by a fixture even if one of them fails to be created
391391
392392
import pytest
393393
394-
from .utils import connect
394+
395+
@contextlib.contextmanager
396+
def connect(port):
397+
... # create connection
398+
yield
399+
... # close connection
395400
396401
397402
@pytest.fixture
@@ -441,7 +446,12 @@ Here's the ``equipments`` fixture changed to use ``addfinalizer`` for cleanup:
441446
442447
import pytest
443448
444-
from .utils import connect
449+
450+
@contextlib.contextmanager
451+
def connect(port):
452+
... # create connection
453+
yield
454+
... # close connection
445455
446456
447457
@pytest.fixture

0 commit comments

Comments
 (0)