Skip to content

Commit

Permalink
Delete files remaining during the test
Browse files Browse the repository at this point in the history
  • Loading branch information
alzhang authored and alzhang committed Apr 19, 2019
1 parent da698b5 commit f9b05dc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion tests/test_select_json_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def test_select_json_object(self, testCase, sql, input_format):

if 'SplitRange' not in input_format and 'LineRange' not in input_format:
testCase.assertEqual(self.scannedSize, file_size)

self.bucket.delete_object(key)
return content

def test_select_json_object_invalid_request(self, testCase, sql, input_format):
Expand Down Expand Up @@ -235,6 +235,7 @@ def test_select_json_object_with_invalid_data(self):
self.assertFalse(True, "expect to raise exception")
except oss2.exceptions.ServerError:
print("Got the exception. Ok.")
self.bucket.delete_object(key)

def test_select_json_object_none_range(self):
print("test_select_json_object_none_range")
Expand All @@ -258,6 +259,7 @@ def test_select_json_object_none_range(self):
content += chunk

self.assertTrue(len(content) > 0)
self.bucket.delete_object(key)

def test_select_json_object_parse_num_as_string(self):
key = "test_select_json_object_parse_num_as_string"
Expand All @@ -267,6 +269,7 @@ def test_select_json_object_parse_num_as_string(self):
for chunk in result:
content += chunk
self.assertEqual(content, b"{\"a\":123456789.123456789}\n")
self.bucket.delete_object(key)

if __name__ == '__main__':
unittest.main()
4 changes: 3 additions & 1 deletion tests/test_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ def test_concurrency(self):
result = self.bucket.get_object(key)
self.assertEqual(content, result.read())
self.assertEqual(result.headers['x-oss-object-type'], 'Multipart')
self.bucket.delete_object(key)

def test_progress(self):
stats = {'previous': -1, 'ncalled': 0}
Expand Down Expand Up @@ -180,7 +181,8 @@ def upload_part(self, key, upload_id, part_number, data):
self.assertEqual(len(list(oss2.ObjectUploadIterator(self.bucket, key))), expected_unfinished)
upload = self.bucket.list_multipart_uploads()
for upload_id in upload.upload_list :
self.bucket.abort_multipart_upload(key, upload_id.upload_id)
if key == upload_id.key:
self.bucket.abort_multipart_upload(key, upload_id.upload_id)
self.bucket.delete_object(key)

def test_interrupt_empty(self):
Expand Down

0 comments on commit f9b05dc

Please sign in to comment.