Skip to content

Commit 22ea641

Browse files
chore: fix test warnings across test suite
1 parent 3e65b9b commit 22ea641

5 files changed

Lines changed: 13 additions & 20 deletions

File tree

‎scripts/install.sh‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@
22
# ./scripts/install.sh
33
# Installs all project dependencies (testing, optional, and tools)
44

5-
set -e
6-
75
script_dir=$(dirname $0)
86
cd ${script_dir}/..
97

108
pip install -U pip
119

12-
pip install -U -r requirements/testing.txt \
13-
-U -r requirements/optional.txt \
14-
-U -r requirements/tools.txt
10+
pip install -U -r requirements/testing.txt
11+
pip install -U -r requirements/optional.txt
12+
pip install -U -r requirements/tools.txt

‎scripts/run_validation.sh‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
# all: ./scripts/run_validation.sh
33
# single: ./scripts/run_validation.sh tests/slack_sdk_async/web/test_web_client_coverage.py
44

5-
set -e
6-
75
script_dir=`dirname $0`
86
cd ${script_dir}/..
97

‎scripts/uninstall_all.sh‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ pip uninstall -y slack-sdk
66
PACKAGES=$(pip freeze | grep -v "^-e" | sed 's/@.*//' | sed 's/\=\=.*//')
77
# uninstall packages without exiting on a failure
88
for package in $PACKAGES; do
9-
pip uninstall -y $package
9+
pip uninstall -y $package &
1010
done
11+
wait

‎tests/rtm/test_rtm_client_functional.py‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
cleanup_mock_web_api_server,
1313
)
1414

15+
websockets_key = web.AppKey("websockets", list) if hasattr(web, "AppKey") else "websockets"
16+
1517

1618
class TestRTMClientFunctional(unittest.TestCase):
1719
def setUp(self):
@@ -53,7 +55,7 @@ def tearDown(self):
5355

5456
async def mock_server(self):
5557
app = web.Application()
56-
app["websockets"] = []
58+
app[websockets_key] = []
5759
app.router.add_get("/", self.websocket_handler)
5860
app.on_shutdown.append(self.on_shutdown)
5961
runner = web.AppRunner(app)
@@ -65,16 +67,16 @@ async def websocket_handler(self, request):
6567
ws = web.WebSocketResponse()
6668
await ws.prepare(request)
6769

68-
request.app["websockets"].append(ws)
70+
request.app[websockets_key].append(ws)
6971
try:
7072
async for msg in ws:
7173
await ws.send_json({"type": "message", "message_sent": msg.json()})
7274
finally:
73-
request.app["websockets"].remove(ws)
75+
request.app[websockets_key].remove(ws)
7476
return ws
7577

7678
async def on_shutdown(self, app):
77-
for ws in set(app["websockets"]):
79+
for ws in set(app[websockets_key]):
7880
await ws.close(code=WSCloseCode.GOING_AWAY, message="Server shutdown")
7981

8082
# -------------------------------------------

‎tests/slack_sdk/socket_mode/mock_socket_mode_server.py‎

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,11 @@ def reset_server_state():
4646
self.reset_server_state = reset_server_state
4747

4848
async def health(request: web.Request):
49-
wr = web.Response()
50-
await wr.prepare(request)
51-
wr.set_status(200)
52-
return wr
49+
return web.Response(status=200)
5350

5451
async def disconnect(request: web.Request):
5552
state["disconnect"] = True
56-
wr = web.Response()
57-
await wr.prepare(request)
58-
wr.set_status(200)
59-
return wr
53+
return web.Response(status=200)
6054

6155
async def link(request):
6256
connected = True

0 commit comments

Comments
 (0)