2
0
Fork 0

Raise AttributeError if no app provider has it

whoops, super().__getattr__() is not really defined
This commit is contained in:
Lance Edgar 2024-05-15 14:22:45 -05:00
parent 51d884ac8b
commit a552e6c471
2 changed files with 6 additions and 3 deletions

View file

@ -2,7 +2,7 @@
################################################################################ ################################################################################
# #
# WuttJamaican -- Base package for Wutta Framework # WuttJamaican -- Base package for Wutta Framework
# Copyright © 2023 Lance Edgar # Copyright © 2023-2024 Lance Edgar
# #
# This file is part of Wutta Framework. # This file is part of Wutta Framework.
# #
@ -96,7 +96,7 @@ class AppHandler:
if hasattr(provider, name): if hasattr(provider, name):
return getattr(provider, name) return getattr(provider, name)
return super().__getattr__(name) raise AttributeError(f"attr not found: {name}")
def get_all_providers(self): def get_all_providers(self):
""" """

View file

@ -3,6 +3,7 @@
import os import os
import shutil import shutil
import tempfile import tempfile
import warnings
from unittest import TestCase from unittest import TestCase
from unittest.mock import patch, MagicMock from unittest.mock import patch, MagicMock
@ -127,7 +128,9 @@ class TestAppProvider(TestCase):
self.assertIs(provider.app, self.app) self.assertIs(provider.app, self.app)
# but can pass app handler instead # 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.config, self.config)
self.assertIs(provider.app, self.app) self.assertIs(provider.app, self.app)