From 9878bbf971cb8db5f889ef9c7efbec01cd5ab1bf Mon Sep 17 00:00:00 2001 From: Tobi-wan Kenobi Date: Sun, 11 Dec 2016 12:31:37 +0100 Subject: [PATCH] [tests] Fix automated testrun in Travis Forgot to mock Popen() in setUp --- tests/modules/test_modules.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/modules/test_modules.py b/tests/modules/test_modules.py index 99723a0..4c54a93 100644 --- a/tests/modules/test_modules.py +++ b/tests/modules/test_modules.py @@ -16,7 +16,9 @@ class MockCommunicate(object): return (str.encode("1"), "error") class TestGenericModules(unittest.TestCase): - def setUp(self): + @mock.patch("subprocess.Popen") + def setUp(self, mock_output): + mock_output.return_value = MockCommunicate() engine = MockEngine() config = Config() self.objects = {} @@ -42,6 +44,10 @@ class TestGenericModules(unittest.TestCase): @mock.patch("subprocess.Popen") def test_update(self, mock_output): mock_output.return_value = MockCommunicate() + rv = mock.Mock() + rv.configure_mock(**{ + "communicate.return_value": ("out", None) + }) for mod in self.objects: widgets = self.objects[mod].widgets() self.objects[mod].update(widgets)