Fix swapped decorators in VppTestCase. 05/16105/2
authorPaul Vinciguerra <pvinci@vinciconsulting.com>
Wed, 21 Nov 2018 17:28:32 +0000 (09:28 -0800)
committerOle Trøan <otroan@employees.org>
Mon, 26 Nov 2018 08:58:22 +0000 (08:58 +0000)
Change-Id: I39b5a8e368f0e0b5c83203141d01f22d909b6f9d
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
test/framework.py

index d985ac6..4fefc04 100644 (file)
@@ -224,8 +224,8 @@ class VppTestCase(unittest.TestCase):
         else:
             raise Exception("Unrecognized DEBUG option: '%s'" % d)
 
-    @classmethod
-    def get_least_used_cpu(self):
+    @staticmethod
+    def get_least_used_cpu():
         cpu_usage_list = [set(range(psutil.cpu_count()))]
         vpp_processes = [p for p in psutil.process_iter(attrs=['pid', 'name'])
                          if 'vpp_main' == p.info['name']]
@@ -253,7 +253,7 @@ class VppTestCase(unittest.TestCase):
 
         return random.choice(tuple(min_usage_set))
 
-    @staticmethod
+    @classmethod
     def print_header(cls):
         if not hasattr(cls, '_header_printed'):
             print(double_line_delim)
@@ -380,7 +380,7 @@ class VppTestCase(unittest.TestCase):
         """
         gc.collect()  # run garbage collection first
         random.seed()
-        cls.print_header(cls)
+        cls.print_header()
         cls.logger = get_logger(cls.__name__)
         if hasattr(cls, 'parallel_handler'):
             cls.logger.addHandler(cls.parallel_handler)
@@ -1190,7 +1190,7 @@ class VppTestResult(unittest.TestResult):
         :param test:
 
         """
-        test.print_header(test.__class__)
+        test.print_header()
 
         unittest.TestResult.startTest(self, test)
         if self.verbosity > 0: