def test_to_absolute_path(hydra_restore_singletons: Any, orig_cwd: str, path: str, expected: str) -> None: # normalize paths to current OS orig_cwd = str(Path(orig_cwd)) path = str(Path(path)) expected = str(Path(expected)) cfg = OmegaConf.create( {"hydra": HydraConf(runtime=RuntimeConf(cwd=orig_cwd))}) assert isinstance(cfg, DictConfig) HydraConfig().set_config(cfg) assert utils.to_absolute_path(path) == expected
def test_get_original_cwd(hydra_restore_singletons: Any) -> None: orig = "/foo/AClass" cfg = OmegaConf.create({"hydra": HydraConf(runtime=RuntimeConf(cwd=orig))}) assert isinstance(cfg, DictConfig) HydraConfig.instance().set_config(cfg) assert utils.get_original_cwd() == orig