Add config parser functionality

Signed-off-by: Václav Valíček <valicek1994@gmail.com>
This commit is contained in:
2022-07-24 21:14:05 +02:00
parent b31b2e199b
commit 8e92bc70a7
9 changed files with 265 additions and 11 deletions

View File

@@ -102,3 +102,25 @@ def test_has_config(tmp_path: PosixPath):
tmp_path.joinpath("config", "cloner.cfg").touch()
assert X.has_config
def test_config_file(tmp_path: PosixPath):
X = RepoDirStructure(tmp_path)
assert X.config_file == tmp_path.joinpath("config", "cloner.cfg").__str__()
def test_get_config(tmp_path: PosixPath):
tmp_path.joinpath("config").mkdir()
tmp_path.joinpath("cache").mkdir()
tmp_path.joinpath("repos").mkdir()
X = RepoDirStructure(tmp_path)
# no file provided
with pytest.raises(ConfigFileNotFoundError) as excinfo:
X.config
# create config file
tmp_path.joinpath("config", "cloner.cfg").touch()
X = RepoDirStructure(tmp_path)
assert X.has_config == True
assert 5 == X.config.cloner_interval