From 633934842b94d1ac70acaba0ef8ccb55cd44e816 Mon Sep 17 00:00:00 2001 From: Daniel Schadt Date: Sat, 4 Mar 2023 22:43:31 +0100 Subject: fix deprecated SQLAlchemy functions Getting ready for SQLAlchemy 2.0! --- tests/conftest.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/conftest.py b/tests/conftest.py index a203775..a499bec 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -59,9 +59,9 @@ def data_manager(app_settings): def _cleanup_data(app_settings): yield engine = models.get_engine(app_settings) - connection = engine.connect() - for table in reversed(Base.metadata.sorted_tables): - connection.execute(table.delete()) + with engine.begin() as connection: + for table in reversed(Base.metadata.sorted_tables): + connection.execute(table.delete()) data_dir = Path(app_settings["fietsboek.data_dir"]) if (data_dir / "tracks").is_dir(): shutil.rmtree(data_dir / "tracks") -- cgit v1.2.3