aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorPaul Vinciguerra <pvinci@vinciconsulting.com>2018-11-21 09:54:50 -0800
committerOle Trøan <otroan@employees.org>2018-11-22 06:59:19 +0000
commitc32023b9fd6970ed1cac1b3c7f36233b536d9968 (patch)
tree969810d8f77faa9ab7be3fc6e6fb8bf25b343ba2 /test
parent5642109506e304c9817434b6f82616dcad83698f (diff)
Fix instance method call in test/framework.py
Instance method breaking encapsulation by calling a global fn. Change-Id: Ifde2a207951143764aed75f1b191aed0bac83704 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
Diffstat (limited to 'test')
-rw-r--r--test/framework.py15
-rw-r--r--test/run_tests.py8
2 files changed, 8 insertions, 15 deletions
diff --git a/test/framework.py b/test/framework.py
index 4c536e062b0..019f366dabe 100644
--- a/test/framework.py
+++ b/test/framework.py
@@ -983,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
@@ -1175,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):
"""
diff --git a/test/run_tests.py b/test/run_tests.py
index b2de2e702fb..361990b8931 100644
--- a/test/run_tests.py
+++ b/test/run_tests.py
@@ -15,7 +15,7 @@ from multiprocessing import Process, Pipe, cpu_count
from multiprocessing.queues import Queue
from multiprocessing.managers import BaseManager
from framework import VppTestRunner, running_extended_tests, VppTestCase, \
- get_testcase_doc_name, get_test_description, PASS, FAIL, ERROR, SKIP, \
+ get_testcase_doc_name, PASS, FAIL, ERROR, SKIP, \
TEST_RUN
from debug import spawn_gdb
from log import get_parallel_logger, double_line_delim, RED, YELLOW, GREEN, \
@@ -88,7 +88,7 @@ class TestResult(dict):
def get_testcase_names(self, test_id):
if re.match(r'.+\..+\..+', test_id):
- test_name = self._get_test_description(test_id)
+ test_name = test_id.getDescription()
testcase_name = self._get_testcase_doc_name(test_id)
else:
# could be tearDownClass (test_ipsec_esp.TestIpsecEsp1)
@@ -108,10 +108,6 @@ class TestResult(dict):
return testcase_name, test_name
- def _get_test_description(self, test_id):
- return get_test_description(descriptions,
- self.testcases_by_id[test_id])
-
def _get_testcase_doc_name(self, test_id):
return get_testcase_doc_name(self.testcases_by_id[test_id])