Skip to content

Commit 733e2e9

Browse files
Copilotkjy5
andcommitted
Fix linting issues and remove unused code
Co-authored-by: kjy5 <[email protected]>
1 parent 2c01c68 commit 733e2e9

File tree

3 files changed

+0
-25
lines changed

3 files changed

+0
-25
lines changed

src/ephys_link/back_end/server.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
from ephys_link.utils.constants import (
3535
MALFORMED_REQUEST_ERROR,
3636
PORT,
37-
SERVER_NOT_INITIALIZED_ERROR,
3837
UNKNOWN_EVENT_ERROR,
3938
cannot_connect_as_client_is_already_connected_error,
4039
client_disconnected_without_being_connected_error,
@@ -63,10 +62,6 @@ def __init__(self, options: EphysLinkOptions, platform_handler: PlatformHandler,
6362

6463
# Initialize server.
6564
self._sio: AsyncServer = AsyncServer()
66-
# Exit if _sio is not a Server.
67-
if not isinstance(self._sio, AsyncServer):
68-
self._console.critical_print(SERVER_NOT_INITIALIZED_ERROR)
69-
raise TypeError(SERVER_NOT_INITIALIZED_ERROR)
7065

7166
self._app = Application()
7267
self._sio.attach(self._app) # pyright: ignore [reportUnknownMemberType]

src/ephys_link/utils/constants.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@ def did_not_reach_target_depth_error(request: SetDepthRequest, final_unified_dep
5858

5959
EMERGENCY_STOP_MESSAGE = "Emergency Stopping All Manipulators..."
6060

61-
SERVER_NOT_INITIALIZED_ERROR = "Server not initialized."
62-
6361

6462
def cannot_connect_as_client_is_already_connected_error(new_client_sid: str, current_client_sid: str) -> str:
6563
"""Generate an error message for when the client is already connected.

tests/back_end/test_server.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
import asyncio
21
from json import dumps, loads
32

43
import pytest
54
from pytest_mock import MockerFixture
6-
from socketio import AsyncServer # pyright: ignore[reportMissingTypeStubs]
75
from vbl_aquarium.models.ephys_link import (
86
AngularResponse,
97
BooleanStateResponse,
@@ -25,7 +23,6 @@
2523
from ephys_link.front_end.console import Console
2624
from ephys_link.utils.constants import (
2725
MALFORMED_REQUEST_ERROR,
28-
SERVER_NOT_INITIALIZED_ERROR,
2926
UNKNOWN_EVENT_ERROR,
3027
cannot_connect_as_client_is_already_connected_error,
3128
client_disconnected_without_being_connected_error,
@@ -49,21 +46,6 @@ def server(self, platform_handler: PlatformHandler, console: Console) -> Server:
4946
"""Fixture for server."""
5047
return Server(EphysLinkOptions(), platform_handler, console)
5148

52-
def test_failed_server_init(
53-
self, platform_handler: PlatformHandler, console: Console, mocker: MockerFixture
54-
) -> None:
55-
"""Server should raise error if sio is not an AsyncServer."""
56-
# Mock out the AsyncServer init.
57-
patched_async_server = mocker.patch.object(AsyncServer, "__new__")
58-
59-
# Act
60-
with pytest.raises(TypeError) as init_error:
61-
_ = Server(EphysLinkOptions(), platform_handler, console)
62-
63-
# Assert
64-
patched_async_server.assert_called_once()
65-
assert init_error.value.args[0] == SERVER_NOT_INITIALIZED_ERROR
66-
6749
def test_launch_server(
6850
self, server: Server, platform_handler: PlatformHandler, console: Console, mocker: MockerFixture
6951
) -> None:

0 commit comments

Comments
 (0)