Fix network_load test

It was using old network_load.sleep and also was not shutting down network_load 
in case it failed test
This commit is contained in:
ZyX 2013-03-25 18:45:43 +04:00
parent 3f53aa298a
commit ada5dede25

View File

@ -206,8 +206,9 @@ class TestCommon(TestCase):
with replace_attr(common, '_get_bytes', _get_bytes):
common.network_load.startup(pl=pl)
try:
self.assertEqual(common.network_load(pl=pl, interface='eth0'), None)
common.network_load.sleep(0)
sleep(common.network_load.interval)
self.assertEqual(common.network_load(pl=pl, interface='eth0'), None)
while 'prev' not in common.network_load.interfaces.get('eth0', {}):
sleep(0.1)
@ -252,6 +253,7 @@ class TestCommon(TestCase):
{'divider_highlight_group': 'background:divider', 'contents': 'r 1 KiB/s', 'highlight_group': ['network_load_recv', 'network_load']},
{'divider_highlight_group': 'background:divider', 'contents': 's 2 KiB/s', 'highlight_group': ['network_load_sent_gradient', 'network_load_gradient', 'network_load_sent', 'network_load'], 'gradient_level': ApproxEqual()},
])
finally:
common.network_load.shutdown()
def test_virtualenv(self):