From ca988df8d0afb16480b13789b311aea69b2a58d9 Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Thu, 23 Jul 2026 09:49:15 -0700 Subject: [PATCH] test(slack): importorskip real slack_sdk/slack_bolt in transient-edit tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CI shards run without the slack extras; the two #64267 tests import the real SDK (SlackApiError, the lazy-rebind path) and errored with ModuleNotFoundError. Skip on bare environments — classification coverage for stdlib exception types (OSError/TimeoutError/cert errors) still runs everywhere. --- tests/gateway/test_slack_block_kit_adapter.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/gateway/test_slack_block_kit_adapter.py b/tests/gateway/test_slack_block_kit_adapter.py index ab35f413048..59351d72e91 100644 --- a/tests/gateway/test_slack_block_kit_adapter.py +++ b/tests/gateway/test_slack_block_kit_adapter.py @@ -236,7 +236,12 @@ class TestEditMessageBlocks: @pytest.mark.asyncio async def test_slack_api_error_on_edit_is_not_retryable(self): - from slack_sdk.errors import SlackApiError + # Real slack_sdk required: the test pins that a genuine SlackApiError + # is never misclassified as transient. CI shards without the slack + # extras skip (adapter classification is still covered by the + # OSError/timeout tests above, which use stdlib exceptions). + errors_mod = pytest.importorskip("slack_sdk.errors") + SlackApiError = errors_mod.SlackApiError adapter, client = _make_adapter() client.chat_update = AsyncMock( @@ -309,6 +314,10 @@ class TestEditMessageBlocks: async def test_lazy_rebound_aiohttp_connection_error_is_retryable( self, monkeypatch ): + # Exercises the REAL lazy-import rebind path in + # check_slack_requirements — requires slack_bolt/slack_sdk installed. + pytest.importorskip("slack_bolt") + pytest.importorskip("slack_sdk") import tools.lazy_deps as lazy_deps monkeypatch.setattr(slack_module, "SLACK_AVAILABLE", False)