From ff71c6859dbaf03f6f48ed7a2939bf9002ef7416 Mon Sep 17 00:00:00 2001 From: Nicholas Kegler Date: Sat, 19 Sep 2020 09:41:06 -0300 Subject: [PATCH 1/2] Fixing requirements object not iterable on bad schema. --- pyup/config.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pyup/config.py b/pyup/config.py index 7f760a9..c7ef123 100644 --- a/pyup/config.py +++ b/pyup/config.py @@ -53,6 +53,8 @@ def update_config(self, d): for key, value in d.items(): if hasattr(self, key): if key == "requirements": + if not value: + continue items, value = value, [] for item in items: if isinstance(item, basestring): From deab8bd68b648e58a3f3347a72e0c523d4cc8d86 Mon Sep 17 00:00:00 2001 From: Nicholas Kegler Date: Sat, 19 Sep 2020 10:47:25 -0300 Subject: [PATCH 2/2] Adding test to cover invalid req on update conf. --- tests/test_config.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/test_config.py b/tests/test_config.py index 9d43d59..2a18c05 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -121,6 +121,17 @@ def test_update(self): self.assertEqual(config.requirements[1].pin, True) self.assertEqual(config.requirements[1].compile.specs, ["baz.in", "foo.in"]) + def test_update_with_invalid_requirements_config(self): + update = { + "requirements": None + } + config = Config() + + self.assertEqual(config.requirements, []) + config.update_config(update) + self.assertEqual(config.requirements, []) + self.assertNotEqual(config.requirements, None) + def test_valid_schedule(self): config = Config()