From a552e6c4710dc451c959c8457ca56a92aca7d6df Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Wed, 15 May 2024 14:22:45 -0500 Subject: [PATCH] Raise AttributeError if no app provider has it whoops, super().__getattr__() is not really defined --- src/wuttjamaican/app.py | 4 ++-- tests/test_app.py | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/wuttjamaican/app.py b/src/wuttjamaican/app.py index 9b6efbe..6decf98 100644 --- a/src/wuttjamaican/app.py +++ b/src/wuttjamaican/app.py @@ -2,7 +2,7 @@ ################################################################################ # # WuttJamaican -- Base package for Wutta Framework -# Copyright © 2023 Lance Edgar +# Copyright © 2023-2024 Lance Edgar # # This file is part of Wutta Framework. # @@ -96,7 +96,7 @@ class AppHandler: if hasattr(provider, name): return getattr(provider, name) - return super().__getattr__(name) + raise AttributeError(f"attr not found: {name}") def get_all_providers(self): """ diff --git a/tests/test_app.py b/tests/test_app.py index 9de67c3..3d007d2 100644 --- a/tests/test_app.py +++ b/tests/test_app.py @@ -3,6 +3,7 @@ import os import shutil import tempfile +import warnings from unittest import TestCase from unittest.mock import patch, MagicMock @@ -127,7 +128,9 @@ class TestAppProvider(TestCase): self.assertIs(provider.app, self.app) # but can pass app handler instead - provider = app.AppProvider(self.app) + with warnings.catch_warnings(): + warnings.filterwarnings('ignore', category=DeprecationWarning) + provider = app.AppProvider(self.app) self.assertIs(provider.config, self.config) self.assertIs(provider.app, self.app)