Fix default cloner interval

Signed-off-by: Václav Valíček <valicek1994@gmail.com>
This commit is contained in:
Václav Valíček 2022-07-24 22:47:13 +02:00
parent 21d449a0a9
commit 872b6bad3f
Signed by: valicek
GPG Key ID: FF05BDCA0C73BB31
5 changed files with 10 additions and 8 deletions

View File

@ -13,7 +13,7 @@ class DefaultClonerConfig:
@property @property
def cloner_interval(self) -> int: def cloner_interval(self) -> int:
return 5 return 0
@property @property
def cloner_submodules(self) -> bool: def cloner_submodules(self) -> bool:

View File

@ -38,9 +38,9 @@ def test_cloner_repo_url():
def test_cloner_interval(): def test_cloner_interval():
x = ClonerConfig() x = ClonerConfig()
assert x.cloner_interval == 5
x._ClonerConfig__values['cloner_interval'] = 0
assert x.cloner_interval == 0 assert x.cloner_interval == 0
x._ClonerConfig__values['cloner_interval'] = 5
assert x.cloner_interval == 5
def test_cloner_submodules(): def test_cloner_submodules():
@ -59,9 +59,11 @@ def test_cloner_submodule_depth():
def test_set_property(): def test_set_property():
x = ClonerConfig() x = ClonerConfig()
assert x.cloner_interval == 5
x._set_property("cloner_interval", 0)
assert x.cloner_interval == 0 assert x.cloner_interval == 0
x._set_property("cloner_interval", 5)
assert x.cloner_interval == 5
x._set_property("cloner_interval", "7")
assert x.cloner_interval == 7
# invalid type # invalid type
with pytest.raises(ValueError) as exc: with pytest.raises(ValueError) as exc:

View File

@ -37,7 +37,7 @@ def test_empty_config(config_path: Path):
c = x.config c = x.config
assert c.cloner_project_name == "" assert c.cloner_project_name == ""
assert c.cloner_repo_url == "" assert c.cloner_repo_url == ""
assert c.cloner_interval == 5 assert c.cloner_interval == 0
assert c.cloner_submodules == True assert c.cloner_submodules == True
assert c.cloner_submodule_depth == 50000 assert c.cloner_submodule_depth == 50000

View File

@ -20,7 +20,7 @@ def test_values():
x = DefaultClonerConfig() x = DefaultClonerConfig()
assert x.cloner_project_name == "" assert x.cloner_project_name == ""
assert x.cloner_repo_url == "" assert x.cloner_repo_url == ""
assert x.cloner_interval == 5 assert x.cloner_interval == 0
assert x.cloner_submodules assert x.cloner_submodules
assert x.cloner_submodule_depth == 50000 assert x.cloner_submodule_depth == 50000

View File

@ -123,4 +123,4 @@ def test_get_config(tmp_path: PosixPath):
tmp_path.joinpath("config", "cloner.cfg").touch() tmp_path.joinpath("config", "cloner.cfg").touch()
X = RepoDirStructure(tmp_path) X = RepoDirStructure(tmp_path)
assert X.has_config == True assert X.has_config == True
assert 5 == X.config.cloner_interval assert 0 == X.config.cloner_interval