diff --git a/scripts/install.sh b/scripts/install.sh index 32a3204e8..570d7d1fc 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -2,13 +2,11 @@ # ./scripts/install.sh # Installs all project dependencies (testing, optional, and tools) -set -e - script_dir=$(dirname $0) cd ${script_dir}/.. pip install -U pip -pip install -U -r requirements/testing.txt \ - -U -r requirements/optional.txt \ - -U -r requirements/tools.txt +pip install -U -r requirements/testing.txt +pip install -U -r requirements/optional.txt +pip install -U -r requirements/tools.txt diff --git a/scripts/run_validation.sh b/scripts/run_validation.sh index db6eef6f9..e8742d468 100755 --- a/scripts/run_validation.sh +++ b/scripts/run_validation.sh @@ -2,8 +2,6 @@ # all: ./scripts/run_validation.sh # single: ./scripts/run_validation.sh tests/slack_sdk_async/web/test_web_client_coverage.py -set -e - script_dir=`dirname $0` cd ${script_dir}/.. diff --git a/scripts/uninstall_all.sh b/scripts/uninstall_all.sh index 71a1e51f6..a78ed0328 100755 --- a/scripts/uninstall_all.sh +++ b/scripts/uninstall_all.sh @@ -6,5 +6,6 @@ pip uninstall -y slack-sdk PACKAGES=$(pip freeze | grep -v "^-e" | sed 's/@.*//' | sed 's/\=\=.*//') # uninstall packages without exiting on a failure for package in $PACKAGES; do - pip uninstall -y $package + pip uninstall -y $package & done +wait diff --git a/tests/rtm/test_rtm_client_functional.py b/tests/rtm/test_rtm_client_functional.py index a7323342b..97d1f2eed 100644 --- a/tests/rtm/test_rtm_client_functional.py +++ b/tests/rtm/test_rtm_client_functional.py @@ -12,6 +12,8 @@ cleanup_mock_web_api_server, ) +websockets_key = web.AppKey("websockets", list) if hasattr(web, "AppKey") else "websockets" + class TestRTMClientFunctional(unittest.TestCase): def setUp(self): @@ -53,7 +55,7 @@ def tearDown(self): async def mock_server(self): app = web.Application() - app["websockets"] = [] + app[websockets_key] = [] app.router.add_get("/", self.websocket_handler) app.on_shutdown.append(self.on_shutdown) runner = web.AppRunner(app) @@ -65,16 +67,16 @@ async def websocket_handler(self, request): ws = web.WebSocketResponse() await ws.prepare(request) - request.app["websockets"].append(ws) + request.app[websockets_key].append(ws) try: async for msg in ws: await ws.send_json({"type": "message", "message_sent": msg.json()}) finally: - request.app["websockets"].remove(ws) + request.app[websockets_key].remove(ws) return ws async def on_shutdown(self, app): - for ws in set(app["websockets"]): + for ws in set(app[websockets_key]): await ws.close(code=WSCloseCode.GOING_AWAY, message="Server shutdown") # ------------------------------------------- diff --git a/tests/slack_sdk/socket_mode/mock_socket_mode_server.py b/tests/slack_sdk/socket_mode/mock_socket_mode_server.py index b08bb3252..bc8c00546 100644 --- a/tests/slack_sdk/socket_mode/mock_socket_mode_server.py +++ b/tests/slack_sdk/socket_mode/mock_socket_mode_server.py @@ -46,17 +46,11 @@ def reset_server_state(): self.reset_server_state = reset_server_state async def health(request: web.Request): - wr = web.Response() - await wr.prepare(request) - wr.set_status(200) - return wr + return web.Response(status=200) async def disconnect(request: web.Request): state["disconnect"] = True - wr = web.Response() - await wr.prepare(request) - wr.set_status(200) - return wr + return web.Response(status=200) async def link(request): connected = True