From 11b47f490d85ff0d42291330193f81020b5a2062 Mon Sep 17 00:00:00 2001 From: Vadim Yakshigulov Date: Sat, 17 Feb 2024 15:53:34 +0300 Subject: [PATCH] fix: remove deprecation warning and add single test --- pyproject.toml | 3 +++ tests/conftest.py | 19 +++---------------- tests/test_true_is_true.py | 2 ++ 3 files changed, 8 insertions(+), 16 deletions(-) create mode 100644 tests/test_true_is_true.py diff --git a/pyproject.toml b/pyproject.toml index 21becb1c..cb62fc3c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -54,3 +54,6 @@ warn_required_dynamic_aliases = true [tool.ruff.lint] fixable = ["ALL"] ignore = ["F401"] + +[tool.pytest.ini_options] +filterwarnings = ["ignore::DeprecationWarning"] diff --git a/tests/conftest.py b/tests/conftest.py index 6325bb3f..3d9305ab 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -22,19 +22,6 @@ def prepare_db(): @pytest.fixture(scope="session", autouse=True) -def get_test_session(): - Session = sessionmaker(test_engine, expire_on_commit=False) - yield Session - - -@pytest.fixture(scope="function", autouse=True) -def clean_tables(request, get_test_session): - if "fixture_name" in request.fixturenames: - yield - else: - with get_test_session() as session: - for table_name in Base.metadata.tables.keys(): - table = Base.metadata.tables[table_name] - session.query(table).delete() - session.commit() - yield +def session(): + session = sessionmaker(test_engine, expire_on_commit=False) + yield session diff --git a/tests/test_true_is_true.py b/tests/test_true_is_true.py new file mode 100644 index 00000000..2907fadd --- /dev/null +++ b/tests/test_true_is_true.py @@ -0,0 +1,2 @@ +def test_true_is_true(): + assert True is True