Skip to content

Commit

Permalink
Replace yield_fixture() by fixture()
Browse files Browse the repository at this point in the history
`@pytest.yield_fixture` is deprecated since `pytest-3.0`, see:
https://docs.pytest.org/en/latest/yieldfixture.html
  • Loading branch information
atugushev committed Jul 14, 2020
1 parent d3d1d85 commit 9ff2718
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions tests/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ def handler(request):
return request.param


@pytest.yield_fixture
@pytest.fixture
def logger(handler):
logger_ = logging.getLogger("test_logger")
logger_.addHandler(handler)
yield logger_
logger_.removeHandler(handler)


@pytest.yield_fixture
@pytest.fixture
def formatted_logger(handler):
logger_ = logging.getLogger("formatted_test_logger")
handler.setFormatter(logging.Formatter("%(levelname)s : %(message)s"))
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_extra_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def handler(request):
return request.param


@pytest.yield_fixture
@pytest.fixture
def logger(handler):
logger = logging.getLogger("test")
dummy_filter = DummyFilter()
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def __repr__(self):
return "<TestClass>"


@pytest.yield_fixture
@pytest.fixture
def mock_send(handler):
try:
with mock.patch.object(handler, "send") as mock_send:
Expand Down

0 comments on commit 9ff2718

Please sign in to comment.