예제 #1
0
 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
예제 #2
0
 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
     )
예제 #3
0
 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")
예제 #4
0
 def __init__(
     self,
     config_search_path: ConfigSearchPath,
 ) -> None:
     self.config_search_path = config_search_path
     self.repository = ConfigRepository(config_search_path=config_search_path)
예제 #5
0
 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")
예제 #6
0
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)