def _get_or_fail(self, prop): if prop in self._raw.keys(): return self._raw[prop] else: raise MissingConfigException( f"Missing required configuration: '{self._get_prefix()}{prop}'." )
def test_params_missing(self, dummy_context, mocker): mock_config_loader = mocker.patch.object(DummyContext, "config_loader") mock_config_loader.get.side_effect = MissingConfigException("nope") pattern = "Parameters not found in your Kedro project config" with pytest.warns(UserWarning, match=pattern): actual = dummy_context.params assert actual == {}
def test_params_missing(self, mocker, extra_params, context_class, context_fixture): mock_config_loader = mocker.patch.object(context_class, "config_loader") mock_config_loader.get.side_effect = MissingConfigException("nope") extra_params = extra_params or {} pattern = "Parameters not found in your Kedro project config" with pytest.warns(UserWarning, match=pattern): actual = context_fixture.params assert actual == extra_params