From 9ff271880ccaeb569da219304c1a0feca2e57772 Mon Sep 17 00:00:00 2001 From: Albert Tugushev Date: Tue, 14 Jul 2020 22:03:09 +0700 Subject: [PATCH] Replace yield_fixture() by fixture() `@pytest.yield_fixture` is deprecated since `pytest-3.0`, see: https://docs.pytest.org/en/latest/yieldfixture.html --- tests/helper.py | 4 ++-- tests/integration/test_extra_fields.py | 2 +- tests/unit/test_handler.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/helper.py b/tests/helper.py index b68c7e47b..0cc932f13 100644 --- a/tests/helper.py +++ b/tests/helper.py @@ -63,7 +63,7 @@ def handler(request): return request.param -@pytest.yield_fixture +@pytest.fixture def logger(handler): logger_ = logging.getLogger("test_logger") logger_.addHandler(handler) @@ -71,7 +71,7 @@ def logger(handler): 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")) diff --git a/tests/integration/test_extra_fields.py b/tests/integration/test_extra_fields.py index 624481bdc..d8ff71c70 100644 --- a/tests/integration/test_extra_fields.py +++ b/tests/integration/test_extra_fields.py @@ -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() diff --git a/tests/unit/test_handler.py b/tests/unit/test_handler.py index 8eb762074..b943cc081 100644 --- a/tests/unit/test_handler.py +++ b/tests/unit/test_handler.py @@ -33,7 +33,7 @@ def __repr__(self): return "" -@pytest.yield_fixture +@pytest.fixture def mock_send(handler): try: with mock.patch.object(handler, "send") as mock_send: