From 6fefa7cd6b8631aea64ef7617c759bd89d39b282 Mon Sep 17 00:00:00 2001 From: MatthewLi Date: Fri, 14 Jul 2017 00:30:50 -0400 Subject: [PATCH] testapi: bugfix of tox error log https://gerrit.opnfv.org/gerrit/#/c/37053/ https://build.opnfv.org/ci/job/testapi-verify-master/220/console Change-Id: Id278edad06c2852c662392d75fd3cf4041b03451 Signed-off-by: MatthewLi --- jjb/releng/automate.yml | 4 +++- utils/test/testapi/htmlize/htmlize.py | 1 + utils/test/testapi/opnfv_testapi/tests/unit/resources/test_pod.py | 1 + .../test/testapi/opnfv_testapi/tests/unit/resources/test_project.py | 1 + utils/test/testapi/opnfv_testapi/tests/unit/resources/test_token.py | 1 + utils/test/testapi/requirements.txt | 2 +- utils/test/testapi/setup.py | 6 +++++- utils/test/testapi/tox.ini | 3 +-- utils/test/testapi/update/templates/backup_mongodb.py | 1 + utils/test/testapi/update/templates/update_mongodb.py | 1 + 10 files changed, 16 insertions(+), 5 deletions(-) diff --git a/jjb/releng/automate.yml b/jjb/releng/automate.yml index db672648a..4f6044bb5 100644 --- a/jjb/releng/automate.yml +++ b/jjb/releng/automate.yml @@ -84,7 +84,9 @@ - shell: | cd ./utils/test/{module}/ tox - cp *.xml $WORKSPACE + if [ -e *.xml ];then + cp *.xml $WORKSPACE + fi publishers: - publish-coverage diff --git a/utils/test/testapi/htmlize/htmlize.py b/utils/test/testapi/htmlize/htmlize.py index 4576d9bb0..da6a6cf91 100644 --- a/utils/test/testapi/htmlize/htmlize.py +++ b/utils/test/testapi/htmlize/htmlize.py @@ -33,6 +33,7 @@ def main(args): else: exit(1) + if __name__ == '__main__': parser = argparse.ArgumentParser(description='Create \ Swagger Spec documentation') diff --git a/utils/test/testapi/opnfv_testapi/tests/unit/resources/test_pod.py b/utils/test/testapi/opnfv_testapi/tests/unit/resources/test_pod.py index 8e0ae407d..cb4f1d92c 100644 --- a/utils/test/testapi/opnfv_testapi/tests/unit/resources/test_pod.py +++ b/utils/test/testapi/opnfv_testapi/tests/unit/resources/test_pod.py @@ -85,5 +85,6 @@ class TestPodGet(TestPodBase): else: self.assert_get_body(pod, self.req_e) + if __name__ == '__main__': unittest.main() diff --git a/utils/test/testapi/opnfv_testapi/tests/unit/resources/test_project.py b/utils/test/testapi/opnfv_testapi/tests/unit/resources/test_project.py index 5a2ce7522..0622ba8d4 100644 --- a/utils/test/testapi/opnfv_testapi/tests/unit/resources/test_project.py +++ b/utils/test/testapi/opnfv_testapi/tests/unit/resources/test_project.py @@ -132,5 +132,6 @@ class TestProjectDelete(TestProjectBase): code, body = self.get(self.req_d.name) self.assertEqual(code, httplib.NOT_FOUND) + if __name__ == '__main__': unittest.main() diff --git a/utils/test/testapi/opnfv_testapi/tests/unit/resources/test_token.py b/utils/test/testapi/opnfv_testapi/tests/unit/resources/test_token.py index c9d4b72c4..b4ba88742 100644 --- a/utils/test/testapi/opnfv_testapi/tests/unit/resources/test_token.py +++ b/utils/test/testapi/opnfv_testapi/tests/unit/resources/test_token.py @@ -109,5 +109,6 @@ class TestTokenUpdateProject(TestToken): def _update_success(self, request, body): self.assertIn(request.name, body) + if __name__ == '__main__': unittest.main() diff --git a/utils/test/testapi/requirements.txt b/utils/test/testapi/requirements.txt index 955ffc853..d2a45dcd0 100644 --- a/utils/test/testapi/requirements.txt +++ b/utils/test/testapi/requirements.txt @@ -2,7 +2,7 @@ # of appearance. Changing the order has an impact on the overall integration # process, which may cause wedges in the gate later. -pbr>=1.6 +pbr==2.0.0 setuptools>=16.0 tornado>=3.1,<=4.3 epydoc>=0.3.1 diff --git a/utils/test/testapi/setup.py b/utils/test/testapi/setup.py index 15dda961f..f689cb30e 100644 --- a/utils/test/testapi/setup.py +++ b/utils/test/testapi/setup.py @@ -3,7 +3,11 @@ import setuptools __author__ = 'serena' +try: + import multiprocessing # noqa +except ImportError: + pass setuptools.setup( - setup_requires=['pbr>=1.8'], + setup_requires=['pbr==2.0.0'], pbr=True) diff --git a/utils/test/testapi/tox.ini b/utils/test/testapi/tox.ini index 81c9dfab1..65f5fb68d 100644 --- a/utils/test/testapi/tox.ini +++ b/utils/test/testapi/tox.ini @@ -4,7 +4,7 @@ # and then run "tox" from this directory. [tox] -envlist = py27,pep8 +envlist = pep8,py27 skipsdist = True sitepackages = True @@ -17,7 +17,6 @@ deps = commands= py.test \ --basetemp={envtmpdir} \ - --cov \ {posargs} setenv= HOME = {envtmpdir} diff --git a/utils/test/testapi/update/templates/backup_mongodb.py b/utils/test/testapi/update/templates/backup_mongodb.py index 7e0dd5545..9c2437764 100644 --- a/utils/test/testapi/update/templates/backup_mongodb.py +++ b/utils/test/testapi/update/templates/backup_mongodb.py @@ -40,5 +40,6 @@ def backup(args): cmd = ['mongodump', '-o', '%s' % out] execute(cmd, args) + if __name__ == '__main__': main(backup, parser) diff --git a/utils/test/testapi/update/templates/update_mongodb.py b/utils/test/testapi/update/templates/update_mongodb.py index ba4334aa3..f75959281 100644 --- a/utils/test/testapi/update/templates/update_mongodb.py +++ b/utils/test/testapi/update/templates/update_mongodb.py @@ -85,5 +85,6 @@ def update(args): rename_fields(fields_old2New) rename_collections(collections_old2New) + if __name__ == '__main__': main(update, parser) -- 2.16.6