aboutsummaryrefslogtreecommitdiffstats
path: root/xtesting/core/testcase.py
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2019-11-09 17:34:24 +0100
committerCédric Ollivier <cedric.ollivier@orange.com>2019-11-09 19:11:24 +0100
commite1915df5d0a647a03b36aa607420a41b6457cd74 (patch)
treed9588fde828a4e981972ddcd5d8e4311ddbc7547 /xtesting/core/testcase.py
parentde35b5c2496ed65d7ef25a9ce39b49d24bfa7959 (diff)
Improve file scanning when publishing artifacts
Else it copies files from other testcases if the full suite is executed sequentially. Change-Id: Ic61472e47b655c34823a6fcb3ed3615e8f84a4c1 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com> (cherry picked from commit a48c62165923be6a37aaff5d54918dbe9cb6ff58)
Diffstat (limited to 'xtesting/core/testcase.py')
-rw-r--r--xtesting/core/testcase.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/xtesting/core/testcase.py b/xtesting/core/testcase.py
index fcab1ac3..8341f34d 100644
--- a/xtesting/core/testcase.py
+++ b/xtesting/core/testcase.py
@@ -67,6 +67,8 @@ class TestCase(object):
self.start_time = 0
self.stop_time = 0
self.is_skipped = False
+ self.output_log_name = 'xtesting.log'
+ self.output_debug_log_name = 'xtesting.debug.log'
self.res_dir = "{}/{}".format(self.dir_results, self.case_name)
def __str__(self):
@@ -294,9 +296,19 @@ class TestCase(object):
typ, value, traceback = sys.exc_info()
six.reraise(typ, value, traceback)
path = urllib.parse.urlparse(dst_s3_url).path.strip("/")
+ dst_http_url = os.environ["HTTP_DST_URL"]
output_str = "\n"
self.details["links"] = []
- for root, _, files in os.walk(self.dir_results):
+ for log_file in [self.output_log_name, self.output_debug_log_name]:
+ if os.path.exists(os.path.join(self.dir_results, log_file)):
+ # pylint: disable=no-member
+ b3resource.Bucket(bucket_name).upload_file(
+ os.path.join(self.dir_results, log_file),
+ os.path.join(path, log_file))
+ link = os.path.join(dst_http_url, log_file)
+ output_str += "\n{}".format(link)
+ self.details["links"].append(link)
+ for root, _, files in os.walk(self.res_dir):
for pub_file in files:
# pylint: disable=no-member
b3resource.Bucket(bucket_name).upload_file(
@@ -304,7 +316,6 @@ class TestCase(object):
os.path.join(path, os.path.relpath(
os.path.join(root, pub_file),
start=self.dir_results)))
- dst_http_url = os.environ["HTTP_DST_URL"]
link = os.path.join(dst_http_url, os.path.relpath(
os.path.join(root, pub_file),
start=self.dir_results))