diff --git a/.travis.yml b/.travis.yml index 8d2114d..3cdc51e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,5 +8,4 @@ python: install: - pip install psutil - pip install netifaces - - pip install mock script: nosetests -v tests/ diff --git a/tests/modules/test_modules.py b/tests/modules/test_modules.py index 7db9492..74d543a 100644 --- a/tests/modules/test_modules.py +++ b/tests/modules/test_modules.py @@ -2,11 +2,19 @@ import unittest import importlib +import mock from bumblebee.engine import all_modules from bumblebee.config import Config from tests.util import assertWidgetAttributes, MockEngine +class MockCommunicate(object): + def __init__(self): + self.returncode = 0 + + def communicate(self): + return (str.encode("1"), "error") + class TestGenericModules(unittest.TestCase): def setUp(self): engine = MockEngine() @@ -30,6 +38,7 @@ class TestGenericModules(unittest.TestCase): @mock.patch("subprocess.Popen") def test_update(self, mock_output): + mock_output.return_value = MockCommunicate() for mod in self.objects: widgets = self.objects[mod].widgets() self.objects[mod].update(widgets)