Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 1 addition & 13 deletions slack_bolt/context/say_stream/async_say_stream.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import warnings
from typing import Optional

from slack_sdk.web.async_client import AsyncWebClient
from slack_sdk.web.async_chat_stream import AsyncChatStream

from slack_bolt.warning import ExperimentalWarning


class AsyncSayStream:
client: AsyncWebClient
Expand Down Expand Up @@ -39,16 +36,7 @@ async def __call__(
thread_ts: Optional[str] = None,
**kwargs,
) -> AsyncChatStream:
"""Starts a new chat stream with context.

Warning: This is an experimental feature and may change in future versions.
"""
warnings.warn(
"say_stream is experimental and may change in future versions.",
category=ExperimentalWarning,
stacklevel=2,
)

"""Starts a new chat stream with context."""
channel = channel or self.channel
thread_ts = thread_ts or self.thread_ts
if channel is None:
Expand Down
14 changes: 1 addition & 13 deletions slack_bolt/context/say_stream/say_stream.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import warnings
from typing import Optional

from slack_sdk import WebClient
from slack_sdk.web.chat_stream import ChatStream

from slack_bolt.warning import ExperimentalWarning


class SayStream:
client: WebClient
Expand Down Expand Up @@ -39,16 +36,7 @@ def __call__(
thread_ts: Optional[str] = None,
**kwargs,
) -> ChatStream:
"""Starts a new chat stream with context.

Warning: This is an experimental feature and may change in future versions.
"""
warnings.warn(
"say_stream is experimental and may change in future versions.",
category=ExperimentalWarning,
stacklevel=2,
)

"""Starts a new chat stream with context."""
channel = channel or self.channel
thread_ts = thread_ts or self.thread_ts
if channel is None:
Expand Down
7 changes: 0 additions & 7 deletions slack_bolt/warning/__init__.py

This file was deleted.

20 changes: 4 additions & 16 deletions tests/slack_bolt/context/test_say_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from slack_sdk import WebClient

from slack_bolt.context.say_stream.say_stream import SayStream
from slack_bolt.warning import ExperimentalWarning
from tests.mock_web_api_server import cleanup_mock_web_api_server, setup_mock_web_api_server


Expand All @@ -20,15 +19,13 @@ def teardown_method(self):

def test_missing_channel_raises(self):
say_stream = SayStream(client=self.web_client, channel=None, thread_ts="111.222")
with pytest.warns(ExperimentalWarning):
with pytest.raises(ValueError, match="channel"):
say_stream()
with pytest.raises(ValueError, match="channel"):
say_stream()

def test_missing_thread_ts_raises(self):
say_stream = SayStream(client=self.web_client, channel="C111", thread_ts=None)
with pytest.warns(ExperimentalWarning):
with pytest.raises(ValueError, match="thread_ts"):
say_stream()
with pytest.raises(ValueError, match="thread_ts"):
say_stream()

def test_default_params(self):
say_stream = SayStream(
Expand Down Expand Up @@ -92,12 +89,3 @@ def test_buffer_size_overrides(self):
"recipient_user_id": "U222",
"task_display_mode": None,
}

def test_experimental_warning(self):
say_stream = SayStream(
client=self.web_client,
channel="C111",
thread_ts="111.222",
)
with pytest.warns(ExperimentalWarning, match="say_stream is experimental"):
say_stream()
21 changes: 4 additions & 17 deletions tests/slack_bolt_async/context/test_async_say_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from slack_sdk.web.async_client import AsyncWebClient

from slack_bolt.context.say_stream.async_say_stream import AsyncSayStream
from slack_bolt.warning import ExperimentalWarning
from tests.mock_web_api_server import (
cleanup_mock_web_api_server,
setup_mock_web_api_server,
Expand All @@ -29,16 +28,14 @@ def setup_teardown(self):
@pytest.mark.asyncio
async def test_missing_channel_raises(self):
say_stream = AsyncSayStream(client=self.web_client, channel=None, thread_ts="111.222")
with pytest.warns(ExperimentalWarning):
with pytest.raises(ValueError, match="channel"):
await say_stream()
with pytest.raises(ValueError, match="channel"):
await say_stream()

@pytest.mark.asyncio
async def test_missing_thread_ts_raises(self):
say_stream = AsyncSayStream(client=self.web_client, channel="C111", thread_ts=None)
with pytest.warns(ExperimentalWarning):
with pytest.raises(ValueError, match="thread_ts"):
await say_stream()
with pytest.raises(ValueError, match="thread_ts"):
await say_stream()

@pytest.mark.asyncio
async def test_default_params(self):
Expand Down Expand Up @@ -105,13 +102,3 @@ async def test_buffer_size_overrides(self):
"recipient_user_id": "U222",
"task_display_mode": None,
}

@pytest.mark.asyncio
async def test_experimental_warning(self):
say_stream = AsyncSayStream(
client=self.web_client,
channel="C111",
thread_ts="111.222",
)
with pytest.warns(ExperimentalWarning, match="say_stream is experimental"):
await say_stream()
Loading