aboutsummaryrefslogtreecommitdiffstats
path: root/functest/ci/run_tests.py
diff options
context:
space:
mode:
authorJose Lausuch <jose.lausuch@ericsson.com>2017-05-05 14:33:49 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-05-05 14:33:49 +0000
commit25e6056936b358d7556865deb8f3e86f63248efe (patch)
tree383caa032bc865e660c2181d10da3e29c852cb3e /functest/ci/run_tests.py
parent6e4d097a8881fa0cfcc2c192639eb0f17ce025a2 (diff)
parentee26a1ca85fc5fac6df6c39f362fad83de73c0cc (diff)
Merge "Print the real testcase duration"
Diffstat (limited to 'functest/ci/run_tests.py')
-rwxr-xr-xfunctest/ci/run_tests.py18
1 files changed, 7 insertions, 11 deletions
diff --git a/functest/ci/run_tests.py b/functest/ci/run_tests.py
index 073e09a7..ae002c2e 100755
--- a/functest/ci/run_tests.py
+++ b/functest/ci/run_tests.py
@@ -9,7 +9,6 @@
#
import argparse
-import datetime
import enum
import importlib
import logging
@@ -121,8 +120,8 @@ def get_run_dict(testname):
def run_test(test, tier_name, testcases=None):
+ duration = "XX:XX"
result_str = "PASS"
- start = datetime.datetime.now()
test_name = test.get_name()
logger.info("\n") # blank line
print_separator("=")
@@ -146,7 +145,6 @@ def run_test(test, tier_name, testcases=None):
cls = getattr(module, run_dict['class'])
test_dict = ft_utils.get_dict_by_test(test_name)
test_case = cls(**test_dict)
-
try:
kwargs = run_dict['args']
result = test_case.run(**kwargs)
@@ -155,7 +153,8 @@ def run_test(test, tier_name, testcases=None):
if result == testcase.TestCase.EX_OK:
if GlobalVariables.REPORT_FLAG:
test_case.push_to_db()
- result = test_case.check_result()
+ result = test_case.is_successful()
+ duration = test_case.get_duration()
except ImportError:
logger.exception("Cannot import module {}".format(
run_dict['module']))
@@ -168,12 +167,9 @@ def run_test(test, tier_name, testcases=None):
if test.needs_clean() and GlobalVariables.CLEAN_FLAG:
cleanup()
- end = datetime.datetime.now()
- duration = (end - start).seconds
- duration_str = ("%02d:%02d" % divmod(duration, 60))
- logger.info("Test execution time: %s" % duration_str)
+ logger.info("Test execution time: %s", duration)
- if result != 0:
+ if result != testcase.TestCase.EX_OK:
logger.error("The test case '%s' failed. " % test_name)
GlobalVariables.OVERALL_RESULT = Result.EX_ERROR
result_str = "FAIL"
@@ -181,12 +177,12 @@ def run_test(test, tier_name, testcases=None):
if test.is_blocking():
if not testcases or testcases == "all":
# if it is a single test we don't print the whole results table
- update_test_info(test_name, result_str, duration_str)
+ update_test_info(test_name, result_str, duration)
generate_report.main(GlobalVariables.EXECUTED_TEST_CASES)
raise BlockingTestFailed("The test case {} failed and is blocking"
.format(test.get_name()))
- update_test_info(test_name, result_str, duration_str)
+ update_test_info(test_name, result_str, duration)
def run_tier(tier):