diff --git a/pytest_tests/testsuites/conftest.py b/pytest_tests/testsuites/conftest.py index b4b61f12..2e490c3b 100644 --- a/pytest_tests/testsuites/conftest.py +++ b/pytest_tests/testsuites/conftest.py @@ -187,15 +187,19 @@ def s3_client( yield client +@pytest.fixture +def versioning_status(request: pytest.FixtureRequest) -> VersioningStatus: + if "param" in request.__dict__: + return request.param + + return VersioningStatus.UNDEFINED + + @allure.step("Create/delete bucket") @pytest.fixture -def bucket(s3_client: S3ClientWrapper, request: pytest.FixtureRequest): +def bucket(s3_client: S3ClientWrapper, versioning_status: VersioningStatus): bucket_name = s3_client.create_bucket() - versioning_status: Optional[VersioningStatus] = None - if "param" in request.__dict__: - versioning_status = request.param - if versioning_status: s3_helper.set_bucket_versioning(s3_client, bucket_name, versioning_status) diff --git a/pytest_tests/testsuites/services/s3_gate/test_s3_multipart.py b/pytest_tests/testsuites/services/s3_gate/test_s3_multipart.py index 7bcf9a79..9e3b3c1c 100644 --- a/pytest_tests/testsuites/services/s3_gate/test_s3_multipart.py +++ b/pytest_tests/testsuites/services/s3_gate/test_s3_multipart.py @@ -24,7 +24,7 @@ class TestS3GateMultipart(ClusterTestBase): ) @allure.title("{s3_client}: Object Multipart API") - @pytest.mark.parametrize("bucket", [VersioningStatus.ENABLED], indirect=True) + @pytest.mark.parametrize("versioning_status", [VersioningStatus.ENABLED], indirect=True) def test_s3_object_multipart(self, s3_client: S3ClientWrapper, bucket: str): parts_count = 5 file_name_large = generate_file(PART_SIZE * parts_count) # 5Mb - min part @@ -58,8 +58,8 @@ class TestS3GateMultipart(ClusterTestBase): got_object = s3_client.get_object(bucket, object_key) assert get_file_hash(got_object) == get_file_hash(file_name_large) - @allure.title("{s3_client}: Multipart abort with") - @pytest.mark.parametrize("bucket", [VersioningStatus.ENABLED], indirect=True) + @allure.title("{s3_client}: Abort Multipart Upload") + @pytest.mark.parametrize("versioning_status", [VersioningStatus.ENABLED], indirect=True) def test_s3_abort_multipart( self, s3_client: S3ClientWrapper, @@ -114,7 +114,7 @@ class TestS3GateMultipart(ClusterTestBase): assert len(objects) == 0, f"Expected no objects in container, got\n{objects}" @allure.title("{s3_client}: Upload Part Copy") - @pytest.mark.parametrize("bucket", [VersioningStatus.ENABLED], indirect=True) + @pytest.mark.parametrize("versioning_status", [VersioningStatus.ENABLED], indirect=True) def test_s3_multipart_copy(self, s3_client: S3ClientWrapper, bucket: str): parts_count = 3 file_name_large = generate_file(PART_SIZE * parts_count) # 5Mb - min part