From b5884ff6ca1d23b54b546e8b8e09a1d9372ba25b Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 5 Aug 2024 22:39:45 -0500 Subject: [PATCH] test: fix more tests for python 3.10 not sure why only that one had problems; this seems to fix --- tests/test_app.py | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/tests/test_app.py b/tests/test_app.py index 7fcba42..3c8aa9c 100644 --- a/tests/test_app.py +++ b/tests/test_app.py @@ -119,15 +119,11 @@ class TestAppHandler(TestCase): def test_get_distribution(self): - # default should always be WuttJamaican (right..?) - dist = self.app.get_distribution() - self.assertEqual(dist, 'WuttJamaican') - - # also works with "non-native" objects - from config import Configuration - config = Configuration({}) - dist = self.app.get_distribution(config) - self.assertEqual(dist, 'python-configuration') + # works with "non-native" objects + from sqlalchemy.orm import Query + query = Query({}) + dist = self.app.get_distribution(query) + self.assertEqual(dist, 'SQLAlchemy') # can override dist via config self.config.setdefault('wuttatest.app_dist', 'importlib_metadata') @@ -135,8 +131,8 @@ class TestAppHandler(TestCase): self.assertEqual(dist, 'importlib_metadata') # but the provided object takes precedence - dist = self.app.get_distribution(config) - self.assertEqual(dist, 'python-configuration') + dist = self.app.get_distribution(query) + self.assertEqual(dist, 'SQLAlchemy') def test_get_distribution_pre_python_3_10(self): @@ -197,19 +193,23 @@ class TestAppHandler(TestCase): from importlib.metadata import version # works with "non-native" objects - from config import Configuration - config = Configuration({}) - ver = self.app.get_version(obj=config) - self.assertEqual(ver, version('python-configuration')) + from sqlalchemy.orm import Query + query = Query({}) + ver = self.app.get_version(obj=query) + self.assertEqual(ver, version('SQLAlchemy')) # can override dist via config - self.config.setdefault('wuttatest.app_dist', 'importlib_metadata') + self.config.setdefault('wuttatest.app_dist', 'python-configuration') ver = self.app.get_version() - self.assertEqual(ver, version('importlib_metadata')) + self.assertEqual(ver, version('python-configuration')) # but the provided object takes precedence - ver = self.app.get_version(obj=config) - self.assertEqual(ver, version('python-configuration')) + ver = self.app.get_version(obj=query) + self.assertEqual(ver, version('SQLAlchemy')) + + # can also specify the dist + ver = self.app.get_version(dist='passlib') + self.assertEqual(ver, version('passlib')) def test_make_title(self): text = self.app.make_title('foo_bar')