def test_config_installed( hydra_global_context: TGlobalHydraContext, # noqa: F811 ) -> None: with hydra_global_context(): config_loader = GlobalHydra.instance().config_loader() assert "my_default_output_dir" in config_loader.get_group_options( "hydra/output")
def test_strict_failure_call_is_strict( self, config_dir: str, hydra_global_context: TGlobalHydraContext, # noqa: F811 config_file: str, overrides: List[str], expected: Any, ) -> None: # default strict false, but call is strict with hydra_global_context(config_dir=config_dir, strict=False): with pytest.raises(AttributeError): compose(config_file=config_file, overrides=overrides, strict=True) # default strict true, but call is false with hydra_global_context(config_dir=config_dir, strict=True): with does_not_raise(): compose(config_file=config_file, overrides=overrides, strict=False)
def test_config_installed(hydra_global_context): # noqa: F811 """ Tests that color options are available for both hydra/hydra_logging and hydra/job_logging """ with hydra_global_context(config_dir="../hydra_plugins/hydra_colorlog/conf"): config_loader = GlobalHydra().hydra.config_loader assert "colorlog" in config_loader.get_group_options("hydra/job_logging") assert "colorlog" in config_loader.get_group_options("hydra/hydra_logging")
def test_compose_config( self, config_dir: str, hydra_global_context: TGlobalHydraContext, # noqa: F811 config_file: str, overrides: List[str], expected: Any, ) -> None: with hydra_global_context(config_dir=config_dir): cfg = hydra.experimental.compose(config_file, overrides) assert cfg == expected
def test_compose_decorator( self, hydra_global_context: TGlobalHydraContext, # noqa: F811 config_dir: str, config_file: str, overrides: List[str], expected: Any, ) -> None: with hydra_global_context(config_dir=config_dir): ret = compose(config_file, overrides) assert ret == expected
def test_compose_config( self, search_path_dir, hydra_global_context, # noqa: F811 config_file, overrides, expected, ): with hydra_global_context(search_path_dir=search_path_dir): cfg = hydra.experimental.compose(config_file, overrides) assert cfg == expected
def test_compose_decorator( self, hydra_global_context, # noqa: F811 search_path_dir, config_file, overrides, expected, ): with hydra_global_context(search_path_dir=search_path_dir): ret = hydra.experimental.compose(config_file, overrides) assert ret == expected
def test_compose( self, hydra_global_context, # noqa: F811 config_dir, config_file, overrides, expected, ): with hydra_global_context(config_dir=config_dir): ret = hydra.experimental.compose(config_file, overrides) assert ret == expected
def test_strict_failure_global_strict( self, config_dir: str, hydra_global_context: TGlobalHydraContext, # noqa: F811 config_file: str, overrides: List[str], expected: Any, ) -> None: # default strict True, call is unspecified overrides.append("fooooooooo=bar") with hydra_global_context(config_dir=config_dir, strict=True): with pytest.raises(AttributeError): hydra.experimental.compose(config_file, overrides)
def test_strict_failure_global_strict( self, hydra_global_context, # noqa: F811 config_dir, config_file, overrides, expected, ): # default strict True, call is unspecified overrides.append("fooooooooo=bar") with hydra_global_context(config_dir=config_dir, strict=True): with pytest.raises(KeyError): hydra.experimental.compose(config_file, overrides)
def test_strict_failure_call_is_strict( self, hydra_global_context, # noqa: F811 config_dir, config_file, overrides, expected, ): # default strict false, but call is strict with hydra_global_context(config_dir=config_dir, strict=False): with pytest.raises(KeyError): hydra.experimental.compose(config_file=config_file, overrides=overrides, strict=True) # default strict true, but call is false with hydra_global_context(config_dir=config_dir, strict=True): with does_not_raise(): hydra.experimental.compose(config_file=config_file, overrides=overrides, strict=False)
def test_strict_failure_disabled_on_call( self, config_dir: str, hydra_global_context: TGlobalHydraContext, # noqa: F811 config_file: str, overrides: List[str], expected: Any, ) -> None: # default strict true, but call is false with hydra_global_context(config_dir=config_dir, strict=True): with does_not_raise(): hydra.experimental.compose(config_file=config_file, overrides=overrides, strict=False)
def test_strict_failure_disabled_on_call( self, hydra_global_context, # noqa: F811 config_dir, config_file, overrides, expected, ): # default strict true, but call is false with hydra_global_context(config_dir=config_dir, strict=True): with does_not_raise(): hydra.experimental.compose(config_file=config_file, overrides=overrides, strict=False)
def test_config_installed( hydra_global_context: TGlobalHydraContext, # noqa: F811 ) -> None: """ Tests that color options are available for both hydra/hydra_logging and hydra/job_logging """ with hydra_global_context( config_dir="../hydra_plugins/hydra_colorlog/conf"): gh = GlobalHydra.instance() assert gh.hydra is not None config_loader = gh.hydra.config_loader assert "colorlog" in config_loader.get_group_options( "hydra/job_logging") assert "colorlog" in config_loader.get_group_options( "hydra/hydra_logging")