def test_user_logic(overrides: List[str], expected: int) -> None: try: initialize_with_module(calling_module="hydra_app.main", config_path="conf") cfg = compose(config_name="config", overrides=overrides) assert add(cfg.app, "num1", "num2") == expected finally: GlobalHydra.instance().clear()
def test_initialize_with_module(hydra_restore_singletons: Any) -> None: initialize_with_module(module="tests.test_apps.app_with_cfg_groups.my_app", config_path="conf") assert compose(config_name="config") == { "optimizer": { "type": "nesterov", "lr": 0.001 } }
def test_generated_config(self) -> None: try: # config is relative to a module initialize_with_module(calling_module="hydra_app.main", config_path="conf") cfg = compose(config_name="config", overrides=["app.user=test_user"]) assert cfg == { "app": {"user": "******", "num1": 10, "num2": 20}, "db": {"host": "localhost", "port": 3306}, } finally: GlobalHydra.instance().clear()