diff --git a/kiwi_scp/config.py b/kiwi_scp/config.py index 48a8217..97956d3 100644 --- a/kiwi_scp/config.py +++ b/kiwi_scp/config.py @@ -154,15 +154,13 @@ class KiwiConfig(BaseModel): return cls() - def get_project_config(self, name: str) -> ProjectConfig: + def get_project_config(self, name: str) -> Optional[ProjectConfig]: """returns the config of a project with a given name""" for project in self.projects: if project.name == name: return project - raise ValueError("No Such Project") - @property def kiwi_dict(self) -> Dict[str, Any]: """write this object as a dictionary of strings""" diff --git a/tests/test_config.py b/tests/test_config.py index 61b78a1..d986fff 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -149,10 +149,7 @@ class TestProject: assert c == KiwiConfig(projects=[]) assert c.projects == [] - with pytest.raises(ValueError) as exc_info: - c.get_project_config("invalid") - - assert str(exc_info.value) == "No Such Project" + assert c.get_project_config("invalid") is None def test_long(self): kiwi_dict = {