From 8068c2632724805d25abdc5c2faff85f993b05c2 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 5 Aug 2024 22:41:58 -0500 Subject: [PATCH] test: skip some tests for nodb scenario --- tests/test_app.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/test_app.py b/tests/test_app.py index 3c8aa9c..8525a26 100644 --- a/tests/test_app.py +++ b/tests/test_app.py @@ -119,8 +119,12 @@ class TestAppHandler(TestCase): def test_get_distribution(self): + try: + from sqlalchemy.orm import Query + except ImportError: + pytest.skip("test is not relevant without sqlalchemy") + # works with "non-native" objects - from sqlalchemy.orm import Query query = Query({}) dist = self.app.get_distribution(query) self.assertEqual(dist, 'SQLAlchemy') @@ -192,8 +196,12 @@ class TestAppHandler(TestCase): def test_get_version(self): from importlib.metadata import version + try: + from sqlalchemy.orm import Query + except ImportError: + pytest.skip("test is not relevant without sqlalchemy") + # works with "non-native" objects - from sqlalchemy.orm import Query query = Query({}) ver = self.app.get_version(obj=query) self.assertEqual(ver, version('SQLAlchemy'))