diff --git a/tests/config/test_omegaconf_config.py b/tests/config/test_omegaconf_config.py index 16bb99bfd5..1a2fe02ca2 100644 --- a/tests/config/test_omegaconf_config.py +++ b/tests/config/test_omegaconf_config.py @@ -162,7 +162,7 @@ def _create_config_dir(request, tmp_path, base_config, local_config): _create_config_dir, params=["nested", "flat"], name="create_config_dir_all" ) use_config_dir = pytest.mark.usefixtures("create_config_dir") -use_config_dir_all = pytest.mark.usefixtures("use_config_dir_all") +use_config_dir_all = pytest.mark.usefixtures("create_config_dir_all") use_proj_catalog = pytest.mark.usefixtures("proj_catalog") use_credentials_env_variable_yml = pytest.mark.usefixtures( "proj_credentials_env_variable" @@ -171,7 +171,7 @@ def _create_config_dir(request, tmp_path, base_config, local_config): class TestOmegaConfigLoader: - @use_config_dir + @use_config_dir_all def test_load_core_config_dict_syntax(self, tmp_path): """Make sure core config can be fetched with a dict [] access.""" conf = OmegaConfigLoader(str(tmp_path)) @@ -181,7 +181,7 @@ def test_load_core_config_dict_syntax(self, tmp_path): assert params["param1"] == 1 assert catalog["trains"]["type"] == "MemoryDataset" - @use_config_dir + @use_config_dir_all def test_load_core_config_get_syntax(self, tmp_path): """Make sure core config can be fetched with .get()""" conf = OmegaConfigLoader(str(tmp_path)) @@ -191,7 +191,7 @@ def test_load_core_config_get_syntax(self, tmp_path): assert params["param1"] == 1 assert catalog["trains"]["type"] == "MemoryDataset" - @use_config_dir + @use_config_dir_all def test_load_local_config_overrides_base(self, tmp_path): """Make sure that configs from `local/` override the ones from `base/`""" @@ -249,7 +249,7 @@ def test_nested(self, tmp_path): assert catalog["cars"]["save_args"]["index"] is True assert catalog["nested"]["type"] == "MemoryDataset" - @use_config_dir + @use_config_dir_all def test_nested_subdirs_duplicate(self, tmp_path, base_config): """Check the error when the configs from subdirectories contain duplicate keys""" @@ -264,7 +264,7 @@ def test_nested_subdirs_duplicate(self, tmp_path, base_config): with pytest.raises(ValueError, match=pattern): OmegaConfigLoader(str(tmp_path))["catalog"] - @use_config_dir + @use_config_dir_all def test_multiple_nested_subdirs_duplicates( self, tmp_path, base_config, local_config ): @@ -298,7 +298,7 @@ def test_multiple_nested_subdirs_duplicates( assert re.search(pattern_catalog_local, str(exc.value)) assert re.search(pattern_nested_local, str(exc.value)) - @use_config_dir + @use_config_dir_all def test_bad_config_syntax(self, tmp_path): conf_path = tmp_path / _BASE_ENV conf_path.mkdir(parents=True, exist_ok=True) @@ -322,7 +322,7 @@ def test_lots_of_duplicates(self, tmp_path): with pytest.raises(ValueError, match=pattern): conf["catalog"] - @use_config_dir + @use_config_dir_all def test_same_key_in_same_dir(self, tmp_path, base_config): """Check the error if 2 files in the same config dir contain the same top-level key""" @@ -337,7 +337,7 @@ def test_same_key_in_same_dir(self, tmp_path, base_config): with pytest.raises(ValueError, match=pattern): OmegaConfigLoader(str(tmp_path))["catalog"] - @use_config_dir + @use_config_dir_all def test_pattern_key_not_found(self, tmp_path): """Check the error if no config files satisfy a given pattern""" key = "non-existent-pattern" @@ -345,7 +345,7 @@ def test_pattern_key_not_found(self, tmp_path): with pytest.raises(KeyError, match=pattern): OmegaConfigLoader(str(tmp_path))[key] - @use_config_dir + @use_config_dir_all def test_cannot_load_non_yaml_or_json_files(self, tmp_path): db_patterns = {"db": ["db*"]} db_config_path = tmp_path / _BASE_ENV / "db.ini" @@ -362,7 +362,7 @@ def test_cannot_load_non_yaml_or_json_files(self, tmp_path): with pytest.raises(MissingConfigException, match=pattern): conf["db"] - @use_config_dir + @use_config_dir_all def test_no_files_found(self, tmp_path): """Check the error if no config files satisfy a given pattern""" pattern = ( @@ -515,7 +515,7 @@ def test_unsupported_merge_strategy(self, tmp_path, mlflow_config): merge_strategy={"mlflow": "hard"}, )["mlflow"] - @use_config_dir + @use_config_dir_all def test_adding_extra_keys_to_confloader(self, tmp_path): """Make sure extra keys can be added directly to the config loader instance.""" conf = OmegaConfigLoader(str(tmp_path)) @@ -525,7 +525,7 @@ def test_adding_extra_keys_to_confloader(self, tmp_path): assert catalog["trains"]["type"] == "MemoryDataset" assert conf["spark"] == {"spark_config": "emr.blabla"} - @use_config_dir + @use_config_dir_all def test_bypass_catalog_config_loading(self, tmp_path): """Make sure core config loading can be bypassed by setting the key and values directly on the config loader instance.""" @@ -534,7 +534,7 @@ def test_bypass_catalog_config_loading(self, tmp_path): assert conf["catalog"] == {"catalog_config": "something_new"} - @use_config_dir + @use_config_dir_all @use_credentials_env_variable_yml def test_load_credentials_from_env_variables(self, tmp_path): """Load credentials from environment variables""" @@ -544,7 +544,7 @@ def test_load_credentials_from_env_variables(self, tmp_path): assert conf["credentials"]["user"]["name"] == "test_user" assert conf["credentials"]["user"]["key"] == "test_key" - @use_config_dir + @use_config_dir_all @use_catalog_env_variable_yml def test_env_resolver_not_used_for_catalog(self, tmp_path): """Check that the oc.env resolver is not used for catalog loading""" @@ -553,7 +553,7 @@ def test_env_resolver_not_used_for_catalog(self, tmp_path): with pytest.raises(errors.UnsupportedInterpolationType): conf["catalog"]["test"]["file_path"] - @use_config_dir + @use_config_dir_all @use_credentials_env_variable_yml def test_env_resolver_is_cleared_after_loading(self, tmp_path): """Check that the ``oc.env`` resolver is cleared after loading credentials @@ -564,7 +564,7 @@ def test_env_resolver_is_cleared_after_loading(self, tmp_path): assert conf["credentials"]["user"]["name"] == "test_user" assert not OmegaConf.has_resolver("oc.env") - @use_config_dir + @use_config_dir_all @use_credentials_env_variable_yml def test_env_resolver_is_registered_after_loading(self, tmp_path): """Check that the ``oc.env`` resolver is registered after loading credentials @@ -577,7 +577,7 @@ def test_env_resolver_is_registered_after_loading(self, tmp_path): assert OmegaConf.has_resolver("oc.env") OmegaConf.clear_resolver("oc.env") - @use_config_dir + @use_config_dir_all def test_load_config_from_tar_file(self, tmp_path): subprocess.run( # noqa: PLW1510 [ @@ -594,7 +594,7 @@ def test_load_config_from_tar_file(self, tmp_path): catalog = conf["catalog"] assert catalog["trains"]["type"] == "MemoryDataset" - @use_config_dir + @use_config_dir_all def test_load_config_from_zip_file(self, tmp_path): def zipdir(path, ziph): # This is a helper method to zip up a directory without keeping the complete directory @@ -618,7 +618,7 @@ def zipdir(path, ziph): catalog = conf["catalog"] assert catalog["trains"]["type"] == "MemoryDataset" - @use_config_dir + @use_config_dir_all def test_variable_interpolation_with_correct_env(self, tmp_path): """Make sure the parameters is interpolated with the correct environment""" conf = OmegaConfigLoader(str(tmp_path)) @@ -626,14 +626,14 @@ def test_variable_interpolation_with_correct_env(self, tmp_path): # Making sure it is not override by local/parameters_global.yml assert params["interpolated_param"] == "base" - @use_config_dir + @use_config_dir_all def test_runtime_params_override_interpolated_value(self, tmp_path): """Make sure interpolated value is updated correctly with runtime_params""" conf = OmegaConfigLoader(str(tmp_path), runtime_params={"test_env": "dummy"}) params = conf["parameters"] assert params["interpolated_param"] == "dummy" - @use_config_dir + @use_config_dir_all @use_credentials_env_variable_yml def test_runtime_params_not_propogate_non_parameters_config(self, tmp_path): """Make sure `catalog`, `credentials`, `logging` or any config other than