From: Cédric Ollivier Date: Wed, 26 Apr 2017 07:18:04 +0000 (+0200) Subject: Catch os.makedirs() exceptions in tempest.py X-Git-Tag: opnfv-5.0.RC1~454 X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=commitdiff_plain;h=d1398b95c40dacdeb1bf03cbfff77a458ccb8235;p=functest.git Catch os.makedirs() exceptions in tempest.py It can raise an error exception if the leaf directory already exists or cannot be created [1]. [1] https://docs.python.org/2/library/os.html JIRA: FUNCTEST-804 Change-Id: Ie410bccf1bb2dfd36df6e918c152ecf94844b5d7 Signed-off-by: Cédric Ollivier --- diff --git a/functest/opnfv_tests/openstack/tempest/tempest.py b/functest/opnfv_tests/openstack/tempest/tempest.py index 8fa413a8f..e6c6b44f7 100644 --- a/functest/opnfv_tests/openstack/tempest/tempest.py +++ b/functest/opnfv_tests/openstack/tempest/tempest.py @@ -208,11 +208,9 @@ class TempestCommon(testcase.TestCase): def run(self): self.start_time = time.time() - - if not os.path.exists(conf_utils.TEMPEST_RESULTS_DIR): - os.makedirs(conf_utils.TEMPEST_RESULTS_DIR) - try: + if not os.path.exists(conf_utils.TEMPEST_RESULTS_DIR): + os.makedirs(conf_utils.TEMPEST_RESULTS_DIR) image_and_flavor = conf_utils.create_tempest_resources() conf_utils.configure_tempest( self.DEPLOYMENT_DIR,