1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
From: Carsten Schoenert <c.schoenert@t-online.de>
Date: Thu, 13 Oct 2022 19:21:13 +0200
Subject: test: Use @pytest.fixture instead of @pytest.yield_fixture
The decorator @pytest.yield_fixture is marked als deprecated since a
long time.
---
tests/conftest.py | 2 +-
tests/test_sqla.py | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/tests/conftest.py b/tests/conftest.py
index 0e9876e..ea76131 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -64,7 +64,7 @@ def book(id):
return "Legend of Bagger Vance"
-@pytest.yield_fixture(scope="function")
+@pytest.fixture(scope="function")
def app():
ctx = _app.test_request_context()
diff --git a/tests/test_sqla.py b/tests/test_sqla.py
index 20b4ab1..b05b71d 100644
--- a/tests/test_sqla.py
+++ b/tests/test_sqla.py
@@ -26,7 +26,7 @@ requires_sqlalchemyschema = pytest.mark.skipif(
class TestSQLAlchemy:
- @pytest.yield_fixture()
+ @pytest.fixture()
def extapp(self):
app_ = Flask("extapp")
app_.testing = True
@@ -58,7 +58,7 @@ class TestSQLAlchemy:
def extma(self, extapp):
return extapp.extensions["flask-marshmallow"]
- @pytest.yield_fixture()
+ @pytest.fixture()
def models(self, db):
class AuthorModel(db.Model):
__tablename__ = "author"
|