CI verify jobs failed due to the update of tox 93/63993/3
authorxudan <xudan16@huawei.com>
Thu, 25 Oct 2018 08:03:23 +0000 (04:03 -0400)
committerxudan <xudan16@huawei.com>
Wed, 31 Oct 2018 04:12:34 +0000 (00:12 -0400)
The LF pod used to run the CI verify jobs have updated the version of tox.
So the CI verify jobs failed.
See https://build.opnfv.org/ci/view/dovetail/job/dovetail-merge-master/476/console

Fix the python format errors
Ignore error 'W503 line break before binary operator'.

Change-Id: Ic2df070447bbea39c877ce7a394d733a95064bb1
Signed-off-by: xudan <xudan16@huawei.com>
dovetail/container.py
dovetail/report.py
dovetail/testcase.py
tox.ini

index 89c68cc..be92a67 100644 (file)
@@ -161,10 +161,9 @@ class Container(object):
               '{hosts_config} {openrc} {cacert_volume} {config_volume} ' \
               '{result_volume} {images_volume} {docker_image} /bin/bash' \
               .format(**locals())
-        dt_utils.exec_cmd(cmd, cls.logger)
-        ret, container_id = \
-            dt_utils.exec_cmd("sudo docker ps | grep " + docker_image +
-                              " | awk '{print $1}' | head -1", cls.logger)
+        ret, container_id = dt_utils.exec_cmd(cmd, cls.logger)
+        if ret != 0:
+            return None
         cls.container_list[valid_type] = container_id
 
         if valid_type.lower() == 'vnftest':
index be8d082..189fba9 100644 (file)
@@ -265,8 +265,7 @@ class FunctestCrawler(Crawler):
             for jsonfile in f:
                 try:
                     data = json.loads(jsonfile)
-                    if (testcase_name == data['case_name'] or
-                        data['project_name'] == "sdnvpn") and \
+                    if testcase_name == data['case_name'] and \
                         build_tag == data['build_tag']:
                         criteria = data['criteria']
                         timestart = data['start_date']
@@ -465,8 +464,8 @@ class FunctestChecker(object):
     def get_sub_testcase(sub_testcase, result):
         if not result:
             return False
-        sub_testcase = re.sub("\[.*?\]", "", sub_testcase)
-        reg = sub_testcase + '[\s+\d+]'
+        sub_testcase = re.sub(r"\[.*?\]", "", sub_testcase)
+        reg = sub_testcase + r'[\s+\d+]'
         find_reg = re.compile(reg)
         for tc in result:
             match = find_reg.findall(tc)
index 8eec938..ba28905 100644 (file)
@@ -298,8 +298,8 @@ class Testcase(object):
                                  "test suite {}".format(testsuite['name']))
             else:
                 selected_tests += optional
-        if (not dt_cfg.dovetail_config['mandatory'] and
-                not dt_cfg.dovetail_config['optional']):
+        if (not dt_cfg.dovetail_config['mandatory']
+                and not dt_cfg.dovetail_config['optional']):
             if mandatory:
                 selected_tests += mandatory
             if optional:
diff --git a/tox.ini b/tox.ini
index 55a9e84..922f7cb 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -34,7 +34,7 @@ commands = python setup.py testr --coverage \
 
 [flake8]
 show-source = True
-ignore = E123,E125,H803,E722
+ignore = E123,E125,H803,E722,W503
 exclude = .tox,dist,docs,*egg,build,.venv,.git
 
 [testenv:docs]