aboutsummaryrefslogtreecommitdiffstats
path: root/xtesting/tests
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 18:01:54 +0100
commita48c62165923be6a37aaff5d54918dbe9cb6ff58 (patch)
tree3d1a1efa4f4ef045288857573f7608ebf5ebecc8 /xtesting/tests
parent256e6b0a10d43e930ecd81078d9cbcd89ebb5a06 (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>
Diffstat (limited to 'xtesting/tests')
-rw-r--r--xtesting/tests/unit/core/test_testcase.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/xtesting/tests/unit/core/test_testcase.py b/xtesting/tests/unit/core/test_testcase.py
index 73062149..6d18a968 100644
--- a/xtesting/tests/unit/core/test_testcase.py
+++ b/xtesting/tests/unit/core/test_testcase.py
@@ -364,7 +364,7 @@ class TestCaseTesting(unittest.TestCase):
def test_publish_artifacts1(self, *args):
self.assertEqual(self.test.publish_artifacts(),
testcase.TestCase.EX_OK)
- args[0].assert_called_once_with(self.test.dir_results)
+ args[0].assert_called_once_with(self.test.res_dir)
args[1].assert_called_once_with(
's3', endpoint_url=os.environ['S3_ENDPOINT_URL'])
@@ -377,10 +377,11 @@ class TestCaseTesting(unittest.TestCase):
error_response, 'NoSuchBucket')
self.assertEqual(self.test.publish_artifacts(),
testcase.TestCase.EX_OK)
- args[0].assert_called_once_with(self.test.dir_results)
+ args[0].assert_called_once_with(self.test.res_dir)
args[1].assert_called_once_with(
's3', endpoint_url=os.environ['S3_ENDPOINT_URL'])
+ @mock.patch('os.path.exists', return_value=True)
@mock.patch('boto3.resource')
@mock.patch('os.walk',
return_value=[
@@ -388,12 +389,20 @@ class TestCaseTesting(unittest.TestCase):
def test_publish_artifacts3(self, *args):
self.assertEqual(self.test.publish_artifacts(),
testcase.TestCase.EX_OK)
- args[0].assert_called_once_with(self.test.dir_results)
+ args[0].assert_called_once_with(self.test.res_dir)
expected = [
mock.call('s3', endpoint_url=os.environ['S3_ENDPOINT_URL']),
mock.call().meta.client.head_bucket(Bucket='xtesting'),
mock.call().Bucket('xtesting'),
mock.call().Bucket().upload_file(
+ '/var/lib/xtesting/results/xtesting.log',
+ 'prefix/xtesting.log'),
+ mock.call().Bucket('xtesting'),
+ mock.call().Bucket().upload_file(
+ '/var/lib/xtesting/results/xtesting.debug.log',
+ 'prefix/xtesting.debug.log'),
+ mock.call().Bucket('xtesting'),
+ mock.call().Bucket().upload_file(
'/var/lib/xtesting/results/bar', 'prefix/bar')]
self.assertEqual(args[1].mock_calls, expected)