Skip to content

Commit

Permalink
Fix test_env_resolver_is_registered_after_loading
Browse files Browse the repository at this point in the history
Signed-off-by: Jannic Holzer <jannic.holzer@quantumblack.com>
  • Loading branch information
jmholzer committed Jan 10, 2023
1 parent 800df92 commit 7e6727f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tests/config/test_omegaconf_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import pytest
import yaml
from omegaconf import OmegaConf, errors
from omegaconf.resolvers import oc
from yaml.parser import ParserError

from kedro.config import MissingConfigException, OmegaConfLoader
Expand Down Expand Up @@ -475,10 +476,12 @@ def test_env_resolver_is_cleared_after_loading(self, tmp_path):
@use_config_dir
@use_credentials_env_variable_yml
def test_env_resolver_is_registered_after_loading(self, tmp_path):
"""Check that the ``oc.env`` resolver is reigstered after loading credentials
"""Check that the ``oc.env`` resolver is registered after loading credentials
in the case that it was registered beforehand"""
conf = OmegaConfLoader(str(tmp_path))
OmegaConf.register_new_resolver("oc.env", oc.env)
os.environ["TEST_USERNAME"] = "test_user"
os.environ["TEST_KEY"] = "test_key"
assert conf["credentials"]["user"]["name"] == "test_user"
assert not OmegaConf.has_resolver("oc.env")
assert OmegaConf.has_resolver("oc.env")
OmegaConf.clear_resolver("oc.env")

0 comments on commit 7e6727f

Please sign in to comment.