Fix instance method call in test/framework.py
[vpp.git] / test / framework.py
index 3201e63..019f366 100644 (file)
@@ -151,6 +151,7 @@ class KeepAliveReporter(object):
 
     def __init__(self):
         self.__dict__ = self._shared_state
+        self._pipe = None
 
     @property
     def pipe(self):
@@ -158,7 +159,7 @@ class KeepAliveReporter(object):
 
     @pipe.setter
     def pipe(self, pipe):
-        if hasattr(self, '_pipe'):
+        if self._pipe is not None:
             raise Exception("Internal error - pipe should only be set once.")
         self._pipe = pipe
 
@@ -356,9 +357,15 @@ class VppTestCase(unittest.TestCase):
     @classmethod
     def wait_for_stats_socket(cls):
         deadline = time.time() + 3
-        while time.time() < deadline or cls.debug_gdb or cls.debug_gdbserver:
+        ok = False
+        while time.time() < deadline or \
+                cls.debug_gdb or cls.debug_gdbserver:
             if os.path.exists(cls.stats_sock):
+                ok = True
                 break
+            time.sleep(0.8)
+        if not ok:
+            cls.logger.critical("Couldn't stat : {}".format(cls.stats_sock))
 
     @classmethod
     def setUpClass(cls):
@@ -976,14 +983,6 @@ def get_testcase_doc_name(test):
     return getdoc(test.__class__).splitlines()[0]
 
 
-def get_test_description(descriptions, test):
-    short_description = test.shortDescription()
-    if descriptions and short_description:
-        return short_description
-    else:
-        return str(test)
-
-
 class TestCaseInfo(object):
     def __init__(self, logger, tempdir, vpp_pid, vpp_bin_path):
         self.logger = logger
@@ -1168,7 +1167,12 @@ class VppTestResult(unittest.TestResult):
         :returns: test description
 
         """
-        return get_test_description(self.descriptions, test)
+        # TODO: if none print warning not raise exception
+        short_description = test.shortDescription()
+        if self.descriptions and short_description:
+            return short_description
+        else:
+            return str(test)
 
     def startTest(self, test):
         """