Raise AttributeError if no app provider has it
whoops, super().__getattr__() is not really defined
This commit is contained in:
parent
51d884ac8b
commit
a552e6c471
|
@ -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):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -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)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue