Skip to content

Commit

Permalink
Overwrite dynaconf public API instead of private one. (#893)
Browse files Browse the repository at this point in the history
  • Loading branch information
limdauto authored Sep 15, 2021
1 parent 80c0d3a commit be13c63
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 13 deletions.
4 changes: 2 additions & 2 deletions kedro/framework/project/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ def validator_func(settings, validators):
class _IsSubclassValidator(Validator):
"""A validator to check if the supplied setting value is a subclass of the default class"""

def _validate_items(self, settings, env=None):
super()._validate_items(settings, env)
def validate(self, settings, *args, **kwargs):
super().validate(settings, *args, **kwargs)

default_class = self.default(settings, self)
for name in self.names:
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ anyconfig~=0.10.0
cachetools~=4.1
click<8.0
cookiecutter~=1.7.0
dynaconf<3.1.6 # Pinned because Dynaconf broke a method signature in 3.1.6 used in Kedro
dynaconf>=3.1.2,<4.0.0
fsspec>=2021.04, <2022.01 # Upper bound set arbitrarily, to be reassessed in early 2022
gitpython~=3.0
jmespath>=0.9.5, <1.0
Expand Down
14 changes: 4 additions & 10 deletions tests/framework/session/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#
# See the License for the specific language governing permissions and
# limitations under the License.
import importlib
import logging
from logging.handlers import QueueHandler, QueueListener
from multiprocessing import Queue
Expand Down Expand Up @@ -462,13 +461,8 @@ def mock_session(


@pytest.fixture(autouse=True)
def mock_import(mocker):
def mock_validate_settings(mocker):
# KedroSession eagerly validates that a project's settings.py is correct by
# importing it. settings.py does not actually exists as part of this test suite,
# so its import is mocked.
settings_module = f"{MOCK_PACKAGE_NAME}.settings"
mocker.patch(
"importlib.import_module",
wraps=importlib.import_module,
side_effect=(lambda x: None if x == settings_module else mocker.DEFAULT),
)
# importing it. settings.py does not actually exists as part of this test suite
# since we are testing session in isolation, so the validation is patched.
mocker.patch("kedro.framework.session.session.validate_settings")

0 comments on commit be13c63

Please sign in to comment.