def test_config_repository_list( self, restore_singletons: Any, path: str, config_path: str, results_filter: Optional[ObjectType], expected: List[str], ) -> None: Plugins.instance() # initializes config_search_path = create_config_search_path(path) repo = ConfigRepository(config_search_path=config_search_path) ret = repo.get_group_options( group_name=config_path, results_filter=results_filter ) assert ret == expected
def test_config_repository_load(self, restore_singletons: Any, path: str) -> None: Plugins.instance() # initializes config_search_path = create_config_search_path(path) repo = ConfigRepository(config_search_path=config_search_path) ret = repo.load_config( config_path="dataset/imagenet.yaml", is_primary_config=False ) assert ret is not None assert ret.config == { "dataset": {"name": "imagenet", "path": "/datasets/imagenet"} } assert ( repo.load_config(config_path="not_found.yaml", is_primary_config=True) is None )
def test_config_repository_exists(self, path: str) -> None: config_search_path = create_config_search_path(path) repo = ConfigRepository(config_search_path=config_search_path) assert repo.exists("dataset/imagenet.yaml") assert not repo.exists("not_found.yaml")
def __init__( self, config_search_path: ConfigSearchPath, ) -> None: self.config_search_path = config_search_path self.repository = ConfigRepository(config_search_path=config_search_path)
def test_config_repository_exists(self, restore_singletons: Any, path: str) -> None: Plugins.instance() # initializes config_search_path = create_config_search_path(path) repo = ConfigRepository(config_search_path=config_search_path) assert repo.exists("dataset/imagenet.yaml") assert not repo.exists("not_found.yaml")
def create_repo() -> IConfigRepository: csp = ConfigSearchPathImpl() csp.append(provider="test", path="file://tests/defaults_list/data") csp.append("schema", "structured://") return ConfigRepository(config_search_path=csp)