Separate wait_until to standalone function

It makes wait_until more usable outside of unittest.TestCase classes.
Part of this patch is renaming pinger module to helpers thus we can have
helpers module with useful utilities for testing.

Change-Id: Ie8e4854c23aa3739b0df618db1b3944466d64bd2
Related-Bug: 1243216
This commit is contained in:
Jakub Libosvar
2014-09-30 18:13:50 +02:00
parent ef86198181
commit f1277a4036
4 changed files with 32 additions and 18 deletions

View File

@@ -14,14 +14,11 @@
# under the License.
import os
import time
from neutron.tests import base
SUDO_CMD = 'sudo -n'
TIMEOUT = 60
SLEEP_INTERVAL = 1
class BaseSudoTestCase(base.BaseTestCase):
@@ -58,8 +55,3 @@ class BaseSudoTestCase(base.BaseTestCase):
def check_sudo_enabled(self):
if not self.sudo_enabled:
self.skipTest('testing with sudo is not enabled')
def wait_until(self, predicate, *args, **kwargs):
with self.assert_max_execution_time(TIMEOUT):
while not predicate(*args, **kwargs):
time.sleep(SLEEP_INTERVAL)