[tests] Fix automated testrun in Travis

Forgot to mock Popen() in setUp
This commit is contained in:
Tobi-wan Kenobi 2016-12-11 12:31:37 +01:00
parent 9fe0915730
commit 9878bbf971

View file

@ -16,7 +16,9 @@ class MockCommunicate(object):
return (str.encode("1"), "error") return (str.encode("1"), "error")
class TestGenericModules(unittest.TestCase): class TestGenericModules(unittest.TestCase):
def setUp(self): @mock.patch("subprocess.Popen")
def setUp(self, mock_output):
mock_output.return_value = MockCommunicate()
engine = MockEngine() engine = MockEngine()
config = Config() config = Config()
self.objects = {} self.objects = {}
@ -42,6 +44,10 @@ class TestGenericModules(unittest.TestCase):
@mock.patch("subprocess.Popen") @mock.patch("subprocess.Popen")
def test_update(self, mock_output): def test_update(self, mock_output):
mock_output.return_value = MockCommunicate() mock_output.return_value = MockCommunicate()
rv = mock.Mock()
rv.configure_mock(**{
"communicate.return_value": ("out", None)
})
for mod in self.objects: for mod in self.objects:
widgets = self.objects[mod].widgets() widgets = self.objects[mod].widgets()
self.objects[mod].update(widgets) self.objects[mod].update(widgets)