From 716bafa90e38d51f0c3bfafd5b137e5823426fb3 Mon Sep 17 00:00:00 2001 From: Tobi-wan Kenobi Date: Sat, 10 Dec 2016 19:45:13 +0100 Subject: [PATCH] [tests] Fix unit tests (at least on my system) --- .travis.yml | 1 - tests/modules/test_modules.py | 9 +++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) 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)