Skip to content

Commit d1a32e6

Browse files
harshavardhanaminio-trusted
authored andcommitted
tests: Negative tests should ignore exceptions properly
1 parent 881755b commit d1a32e6

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

tests/functional/tests.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -628,15 +628,19 @@ def test_negative_put_object_with_path_segment(client, log_output):
628628
object_name,
629629
io.BytesIO(b''), 0)
630630
except ResponseError as err:
631-
pass
631+
if err.code != 'XMinioInvalidObjectName':
632+
raise err
632633
except Exception as err:
633-
raise Exception(err)
634+
raise err
634635
finally:
635636
try:
636637
client.remove_object(bucket_name, object_name)
637-
client.remove_bucket(bucket_name)
638+
except ResponseError as err:
639+
if err.code != 'XMinioInvalidObjectName':
640+
raise err
638641
except Exception as err:
639-
raise Exception(err)
642+
raise err
643+
client.remove_bucket(bucket_name)
640644
# Test passes
641645
print(log_output.json_report())
642646

0 commit comments

Comments
 (0)