[tests] Fix unit tests (at least on my system)
This commit is contained in:
parent
921afe475f
commit
716bafa90e
2 changed files with 9 additions and 1 deletions
|
@ -8,5 +8,4 @@ python:
|
|||
install:
|
||||
- pip install psutil
|
||||
- pip install netifaces
|
||||
- pip install mock
|
||||
script: nosetests -v tests/
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue