Skip to content

Commit

Permalink
Remove @pytest.mark.asyncio decorator
Browse files Browse the repository at this point in the history
  • Loading branch information
disrupted committed Jan 9, 2025
1 parent a14ef38 commit d38a082
Show file tree
Hide file tree
Showing 17 changed files with 0 additions and 137 deletions.
6 changes: 0 additions & 6 deletions tests/component_handlers/helm_wrapper/test_helm_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ def mock_get_version(self, mocker: MockerFixture) -> MagicMock:
def helm(self, mock_get_version: MagicMock) -> Helm:
return Helm(helm_config=HelmConfig())

@pytest.mark.asyncio()
async def test_should_call_run_command_method_when_helm_install_with_defaults(
self, helm: Helm, run_command_async: AsyncMock
):
Expand Down Expand Up @@ -138,7 +137,6 @@ def test_should_include_configured_tls_parameters_on_add_when_version_is_new(
),
]

@pytest.mark.asyncio()
async def test_should_include_configured_tls_parameters_on_update(
self, helm: Helm, run_command_async: AsyncMock
):
Expand Down Expand Up @@ -174,7 +172,6 @@ async def test_should_include_configured_tls_parameters_on_update(
],
)

@pytest.mark.asyncio()
async def test_should_call_run_command_method_when_helm_install_with_non_defaults(
self, helm: Helm, run_command_async: AsyncMock
):
Expand Down Expand Up @@ -219,7 +216,6 @@ async def test_should_call_run_command_method_when_helm_install_with_non_default
],
)

@pytest.mark.asyncio()
async def test_should_call_run_command_method_when_uninstalling_streams_app(
self, helm: Helm, run_command_async: AsyncMock
):
Expand All @@ -232,7 +228,6 @@ async def test_should_call_run_command_method_when_uninstalling_streams_app(
["helm", "uninstall", "test-release", "--namespace", "test-namespace"],
)

@pytest.mark.asyncio()
async def test_should_log_warning_when_release_not_found(
self,
run_command_async: AsyncMock,
Expand All @@ -250,7 +245,6 @@ async def test_should_log_warning_when_release_not_found(
"Release with name test-release not found. Could not uninstall app."
)

@pytest.mark.asyncio()
async def test_should_call_run_command_method_when_installing_streams_app__with_dry_run(
self, helm: Helm, run_command_async: AsyncMock
):
Expand Down
10 changes: 0 additions & 10 deletions tests/component_handlers/kafka_connect/test_connect_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ def connector_config(self) -> KafkaConnectorConfig:
name=CONNECTOR_NAME,
)

@pytest.mark.asyncio()
async def test_should_create_connector_in_dry_run(
self,
connector_config: KafkaConnectorConfig,
Expand All @@ -87,7 +86,6 @@ async def test_should_create_connector_in_dry_run(
),
]

@pytest.mark.asyncio()
async def test_should_log_correct_message_when_create_connector_and_connector_not_exists_in_dry_run(
self, log_info_mock: MagicMock, connector_wrapper: AsyncMock
):
Expand Down Expand Up @@ -116,7 +114,6 @@ async def test_should_log_correct_message_when_create_connector_and_connector_no
),
]

@pytest.mark.asyncio()
async def test_should_log_correct_message_when_create_connector_and_connector_exists_in_dry_run(
self, log_info_mock: MagicMock, connector_wrapper: AsyncMock
):
Expand Down Expand Up @@ -162,7 +159,6 @@ async def test_should_log_correct_message_when_create_connector_and_connector_ex
),
]

@pytest.mark.asyncio()
async def test_should_log_invalid_config_when_create_connector_in_dry_run(
self, connector_config: KafkaConnectorConfig, renderer_diff_mock: MagicMock
):
Expand All @@ -187,7 +183,6 @@ async def test_should_log_invalid_config_when_create_connector_in_dry_run(
connector_config
)

@pytest.mark.asyncio()
async def test_should_call_update_connector_config_when_connector_exists_not_dry_run(
self, connector_config: KafkaConnectorConfig
):
Expand All @@ -202,7 +197,6 @@ async def test_should_call_update_connector_config_when_connector_exists_not_dry
mock.call.update_connector_config(connector_config),
]

@pytest.mark.asyncio()
async def test_should_call_create_connector_when_connector_does_not_exists_not_dry_run(
self, connector_config: KafkaConnectorConfig
):
Expand All @@ -216,7 +210,6 @@ async def test_should_call_create_connector_when_connector_does_not_exists_not_d

connector_wrapper.create_connector.assert_called_once_with(connector_config)

@pytest.mark.asyncio()
async def test_should_print_correct_log_when_destroying_connector_in_dry_run(
self, log_info_mock: MagicMock, connector_wrapper: AsyncMock
):
Expand All @@ -230,7 +223,6 @@ async def test_should_print_correct_log_when_destroying_connector_in_dry_run(
)
)

@pytest.mark.asyncio()
async def test_should_print_correct_warning_log_when_destroying_connector_and_connector_exists_in_dry_run(
self, log_warning_mock: MagicMock, connector_wrapper: AsyncMock
):
Expand All @@ -246,7 +238,6 @@ async def test_should_print_correct_warning_log_when_destroying_connector_and_co
f"Connector Destruction: connector {CONNECTOR_NAME} does not exist and cannot be deleted. Skipping."
)

@pytest.mark.asyncio()
async def test_should_call_delete_connector_when_destroying_existing_connector_not_dry_run(
self, connector_wrapper: AsyncMock
):
Expand All @@ -259,7 +250,6 @@ async def test_should_call_delete_connector_when_destroying_existing_connector_n
mock.call.delete_connector(CONNECTOR_NAME),
]

@pytest.mark.asyncio()
async def test_should_print_correct_warning_log_when_destroying_connector_and_connector_exists_not_dry_run(
self, log_warning_mock: MagicMock, connector_wrapper: AsyncMock
):
Expand Down
18 changes: 0 additions & 18 deletions tests/component_handlers/kafka_connect/test_connect_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ def test_convert_config_values_to_str(self):
"topic.tracking.allow.reset": "false",
}

@pytest.mark.asyncio()
@patch("httpx.AsyncClient.post")
async def test_should_create_post_requests_for_given_connector_configuration(
self, mock_post: AsyncMock
Expand Down Expand Up @@ -94,7 +93,6 @@ async def test_should_create_post_requests_for_given_connector_configuration(
},
)

@pytest.mark.asyncio()
async def test_should_return_correct_response_when_connector_created(
self, httpx_mock: HTTPXMock, connector_config: KafkaConnectorConfig
):
Expand Down Expand Up @@ -131,7 +129,6 @@ async def test_should_return_correct_response_when_connector_created(

assert KafkaConnectResponse(**actual_response) == expected_response

@pytest.mark.asyncio()
@patch("kpops.component_handlers.kafka_connect.connect_wrapper.log.warning")
async def test_should_raise_connector_exists_exception_when_connector_exists(
self,
Expand All @@ -156,7 +153,6 @@ async def test_should_raise_connector_exists_exception_when_connector_exists(
"Rebalancing in progress while creating a connector... Retrying..."
)

@pytest.mark.asyncio()
@patch("httpx.AsyncClient.get")
async def test_should_create_correct_get_connector_request(
self, mock_get: AsyncMock
Expand All @@ -171,7 +167,6 @@ async def test_should_create_correct_get_connector_request(
)

@pytest.mark.flaky(reruns=5, condition=sys.platform.startswith("win32"))
@pytest.mark.asyncio()
@patch("kpops.component_handlers.kafka_connect.connect_wrapper.log.info")
async def test_should_return_correct_response_when_getting_connector(
self, log_info: MagicMock, httpx_mock: HTTPXMock
Expand Down Expand Up @@ -207,7 +202,6 @@ async def test_should_return_correct_response_when_getting_connector(
assert KafkaConnectResponse(**actual_response) == expected_response
log_info.assert_called_once_with(f"Connector {connector_name} exists.")

@pytest.mark.asyncio()
@patch("kpops.component_handlers.kafka_connect.connect_wrapper.log.info")
async def test_should_raise_connector_not_found_when_getting_connector(
self, log_info: MagicMock, httpx_mock: HTTPXMock
Expand All @@ -228,7 +222,6 @@ async def test_should_raise_connector_not_found_when_getting_connector(
f"The named connector {connector_name} does not exists."
)

@pytest.mark.asyncio()
@patch("kpops.component_handlers.kafka_connect.connect_wrapper.log.warning")
async def test_should_raise_rebalance_in_progress_when_getting_connector(
self, log_warning: MagicMock, httpx_mock: HTTPXMock
Expand All @@ -252,7 +245,6 @@ async def test_should_raise_rebalance_in_progress_when_getting_connector(
"Rebalancing in progress while getting a connector... Retrying..."
)

@pytest.mark.asyncio()
@patch("httpx.AsyncClient.put")
async def test_should_create_correct_update_connector_request(
self, mock_put: AsyncMock
Expand All @@ -279,7 +271,6 @@ async def test_should_create_correct_update_connector_request(
json=KafkaConnectorConfig.model_validate(configs).model_dump(),
)

@pytest.mark.asyncio()
@patch("kpops.component_handlers.kafka_connect.connect_wrapper.log.info")
async def test_should_return_correct_response_when_update_connector(
self,
Expand Down Expand Up @@ -323,7 +314,6 @@ async def test_should_return_correct_response_when_update_connector(
f"Config for connector {connector_name} updated."
)

@pytest.mark.asyncio()
@patch("kpops.component_handlers.kafka_connect.connect_wrapper.log.info")
async def test_should_return_correct_response_when_update_connector_created(
self,
Expand Down Expand Up @@ -364,7 +354,6 @@ async def test_should_return_correct_response_when_update_connector_created(
assert KafkaConnectResponse(**actual_response) == expected_response
log_info.assert_called_once_with(f"Connector {connector_name} created.")

@pytest.mark.asyncio()
@patch("kpops.component_handlers.kafka_connect.connect_wrapper.log.warning")
async def test_should_raise_connector_exists_exception_when_update_connector(
self,
Expand All @@ -391,7 +380,6 @@ async def test_should_raise_connector_exists_exception_when_update_connector(
"Rebalancing in progress while updating a connector... Retrying..."
)

@pytest.mark.asyncio()
@patch("httpx.AsyncClient.delete")
async def test_should_create_correct_delete_connector_request(
self, mock_delete: AsyncMock
Expand All @@ -405,7 +393,6 @@ async def test_should_create_correct_delete_connector_request(
headers=HEADERS,
)

@pytest.mark.asyncio()
@patch("kpops.component_handlers.kafka_connect.connect_wrapper.log.info")
async def test_should_return_correct_response_when_deleting_connector(
self, log_info: MagicMock, httpx_mock: HTTPXMock
Expand Down Expand Up @@ -441,7 +428,6 @@ async def test_should_return_correct_response_when_deleting_connector(

log_info.assert_called_once_with(f"Connector {connector_name} deleted.")

@pytest.mark.asyncio()
@patch("kpops.component_handlers.kafka_connect.connect_wrapper.log.info")
async def test_should_raise_connector_not_found_when_deleting_connector(
self, log_info: MagicMock, httpx_mock: HTTPXMock
Expand All @@ -462,7 +448,6 @@ async def test_should_raise_connector_not_found_when_deleting_connector(
f"The named connector {connector_name} does not exists."
)

@pytest.mark.asyncio()
@patch("kpops.component_handlers.kafka_connect.connect_wrapper.log.warning")
async def test_should_raise_rebalance_in_progress_when_deleting_connector(
self, log_warning: MagicMock, httpx_mock: HTTPXMock
Expand All @@ -486,7 +471,6 @@ async def test_should_raise_rebalance_in_progress_when_deleting_connector(
"Rebalancing in progress while deleting a connector... Retrying..."
)

@pytest.mark.asyncio()
@patch("httpx.AsyncClient.put")
async def test_should_create_correct_validate_connector_config_request(
self, mock_put: AsyncMock
Expand All @@ -508,7 +492,6 @@ async def test_should_create_correct_validate_connector_config_request(
json=connector_config.model_dump(),
)

@pytest.mark.asyncio()
@patch("httpx.AsyncClient.put")
async def test_should_create_correct_validate_connector_config_and_name_gets_added(
self, mock_put: AsyncMock
Expand All @@ -533,7 +516,6 @@ async def test_should_create_correct_validate_connector_config_and_name_gets_add
).model_dump(),
)

@pytest.mark.asyncio()
async def test_should_parse_validate_connector_config(self, httpx_mock: HTTPXMock):
content = await Path(
RESOURCES_PATH / "connect_validation_response.json",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ def test_should_raise_value_error_if_schema_provider_class_not_found(
)


@pytest.mark.asyncio()
@pytest.mark.usefixtures("custom_components")
async def test_should_log_info_when_submit_schemas_that_not_exists_and_dry_run_true(
to_section: ToSection,
Expand All @@ -140,7 +139,6 @@ async def test_should_log_info_when_submit_schemas_that_not_exists_and_dry_run_t
schema_registry_mock.register.assert_not_called()


@pytest.mark.asyncio()
@pytest.mark.usefixtures("custom_components")
async def test_should_log_info_when_submit_schemas_that_exists_and_dry_run_true(
topic_config: TopicConfig,
Expand All @@ -163,7 +161,6 @@ async def test_should_log_info_when_submit_schemas_that_exists_and_dry_run_true(
schema_registry_mock.register.assert_not_called()


@pytest.mark.asyncio()
@pytest.mark.usefixtures("custom_components")
async def test_should_raise_exception_when_submit_schema_that_exists_and_not_compatible_and_dry_run_true(
topic_config: TopicConfig,
Expand Down Expand Up @@ -201,7 +198,6 @@ async def test_should_raise_exception_when_submit_schema_that_exists_and_not_com
schema_registry_mock.register.assert_not_called()


@pytest.mark.asyncio()
@pytest.mark.usefixtures("custom_components")
async def test_should_log_debug_when_submit_schema_that_exists_and_registered_under_version_and_dry_run_true(
topic_config: TopicConfig,
Expand Down Expand Up @@ -237,7 +233,6 @@ async def test_should_log_debug_when_submit_schema_that_exists_and_registered_un
schema_registry_mock.register.assert_not_called()


@pytest.mark.asyncio()
@pytest.mark.usefixtures("custom_components")
async def test_should_submit_non_existing_schema_when_not_dry(
topic_config: TopicConfig,
Expand Down Expand Up @@ -266,7 +261,6 @@ async def test_should_submit_non_existing_schema_when_not_dry(
)


@pytest.mark.asyncio()
async def test_should_log_correct_message_when_delete_schemas_and_in_dry_run(
to_section: ToSection,
log_info_mock: MagicMock,
Expand All @@ -286,7 +280,6 @@ async def test_should_log_correct_message_when_delete_schemas_and_in_dry_run(
schema_registry_mock.delete_subject.assert_not_called()


@pytest.mark.asyncio()
async def test_should_delete_schemas_when_not_in_dry_run(
to_section: ToSection,
schema_registry_mock: AsyncMock,
Expand Down
Loading

0 comments on commit d38a082

Please sign in to comment.