Fix fixture example in docs
This commit is contained in:
parent
693e9d0733
commit
1873dc6a8a
|
@ -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