From 872b6bad3ff9b9391128eb344173fe59111532ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Val=C3=AD=C4=8Dek?= Date: Sun, 24 Jul 2022 22:47:13 +0200 Subject: [PATCH] Fix default cloner interval MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Václav Valíček --- repo_cloner/lib/default_cloner_config.py | 2 +- tests/lib/test_cloner_config.py | 10 ++++++---- tests/lib/test_cloner_config_parser.py | 2 +- tests/lib/test_default_cloner_config.py | 2 +- tests/lib/test_repo_dir_structure.py | 2 +- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/repo_cloner/lib/default_cloner_config.py b/repo_cloner/lib/default_cloner_config.py index f3aeada..f55e423 100644 --- a/repo_cloner/lib/default_cloner_config.py +++ b/repo_cloner/lib/default_cloner_config.py @@ -13,7 +13,7 @@ class DefaultClonerConfig: @property def cloner_interval(self) -> int: - return 5 + return 0 @property def cloner_submodules(self) -> bool: diff --git a/tests/lib/test_cloner_config.py b/tests/lib/test_cloner_config.py index b5faa6a..efee077 100644 --- a/tests/lib/test_cloner_config.py +++ b/tests/lib/test_cloner_config.py @@ -38,9 +38,9 @@ def test_cloner_repo_url(): def test_cloner_interval(): x = ClonerConfig() - assert x.cloner_interval == 5 - x._ClonerConfig__values['cloner_interval'] = 0 assert x.cloner_interval == 0 + x._ClonerConfig__values['cloner_interval'] = 5 + assert x.cloner_interval == 5 def test_cloner_submodules(): @@ -59,9 +59,11 @@ def test_cloner_submodule_depth(): def test_set_property(): x = ClonerConfig() - assert x.cloner_interval == 5 - x._set_property("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 with pytest.raises(ValueError) as exc: diff --git a/tests/lib/test_cloner_config_parser.py b/tests/lib/test_cloner_config_parser.py index 9d401e0..d7be7f6 100644 --- a/tests/lib/test_cloner_config_parser.py +++ b/tests/lib/test_cloner_config_parser.py @@ -37,7 +37,7 @@ def test_empty_config(config_path: Path): c = x.config assert c.cloner_project_name == "" assert c.cloner_repo_url == "" - assert c.cloner_interval == 5 + assert c.cloner_interval == 0 assert c.cloner_submodules == True assert c.cloner_submodule_depth == 50000 diff --git a/tests/lib/test_default_cloner_config.py b/tests/lib/test_default_cloner_config.py index 49a517e..4b77ec3 100644 --- a/tests/lib/test_default_cloner_config.py +++ b/tests/lib/test_default_cloner_config.py @@ -20,7 +20,7 @@ def test_values(): x = DefaultClonerConfig() assert x.cloner_project_name == "" assert x.cloner_repo_url == "" - assert x.cloner_interval == 5 + assert x.cloner_interval == 0 assert x.cloner_submodules assert x.cloner_submodule_depth == 50000 diff --git a/tests/lib/test_repo_dir_structure.py b/tests/lib/test_repo_dir_structure.py index e747349..961783a 100644 --- a/tests/lib/test_repo_dir_structure.py +++ b/tests/lib/test_repo_dir_structure.py @@ -123,4 +123,4 @@ def test_get_config(tmp_path: PosixPath): tmp_path.joinpath("config", "cloner.cfg").touch() X = RepoDirStructure(tmp_path) assert X.has_config == True - assert 5 == X.config.cloner_interval + assert 0 == X.config.cloner_interval