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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
|
From: Carsten Schoenert <c.schoenert@t-online.de>
Date: Sun, 26 May 2024 11:32:49 +0200
Subject: tests: Adopt decorators to recent pytest syntax
pytest.yield_fixture is deprecated and replaced by pytest.fixture.
tests/test_now.py:15
/build/sqlalchemy-utc-0.14.0/.pybuild/cpython3_3.11_sqlalchemy-utc/build/tests/test_now.py:15: PytestDeprecationWarning: @pytest.yield_fixture is deprecated.
Use @pytest.fixture instead; they are the same.
@yield_fixture
---
tests/test_now.py | 4 ++--
tests/test_sqltypes.py | 6 +++---
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/tests/test_now.py b/tests/test_now.py
index 8ea9ee6..fc87a87 100644
--- a/tests/test_now.py
+++ b/tests/test_now.py
@@ -1,6 +1,6 @@
import datetime
-from pytest import yield_fixture
+from pytest import fixture
from sqlalchemy import Column, MetaData, Table, select
@@ -12,7 +12,7 @@ TABLE = Table(
Column('time', UtcDateTime, default=utcnow()))
-@yield_fixture
+@fixture
def fx_connection(fx_engine):
connection = fx_engine.connect()
try:
diff --git a/tests/test_sqltypes.py b/tests/test_sqltypes.py
index a9bd2e7..980c5f3 100644
--- a/tests/test_sqltypes.py
+++ b/tests/test_sqltypes.py
@@ -6,7 +6,7 @@ except ImportError:
pass
else:
register()
-from pytest import mark, raises, yield_fixture
+from pytest import mark, raises, fixture
from sqlalchemy.exc import StatementError
from sqlalchemy.ext.declarative import declarative_base
@@ -20,7 +20,7 @@ Base = declarative_base()
Session = sessionmaker()
-@yield_fixture
+@fixture
def fx_connection(fx_engine):
connection = fx_engine.connect()
try:
@@ -35,7 +35,7 @@ def fx_connection(fx_engine):
connection.close()
-@yield_fixture
+@fixture
def fx_session(fx_connection):
session = Session(bind=fx_connection)
try:
|