Skip to content

Commit

Permalink
linter fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
maxlou05 committed Jul 9, 2024
1 parent 7ad5e0c commit f7c474a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
9 changes: 6 additions & 3 deletions network/test_tcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import os
from pathlib import Path
import struct
from typing import Generator
from typing import Any, Generator

import numpy as np
import pytest
Expand All @@ -25,6 +25,7 @@ def test_messages() -> "Generator[bytes]":
"""
Test messages to send to server.
"""

yield [
b"Hello world!",
np.random.bytes(4096),
Expand All @@ -33,10 +34,11 @@ def test_messages() -> "Generator[bytes]":


@pytest.fixture
def myserver(xprocess):
def myserver(xprocess: Any) -> Generator:
"""
Starts echo server.
"""

myenv = os.environ.copy()
myenv["PYTHONPATH"] = str(ROOT_DIR)
myenv["PYTHONUNBUFFERED"] = "1"
Expand All @@ -45,6 +47,7 @@ class Starter(ProcessStarter):
"""
xprocess config to start the server as another process.
"""

pattern = f"Listening for external connections on port {SERVER_PORT}"
timeout = 60
args = ["python", "-m", "network.start_tcp_receiver"]
Expand All @@ -58,7 +61,7 @@ class Starter(ProcessStarter):


# pylint: disable=W0621,W0613
def test_client(test_messages, myserver) -> int:
def test_client(test_messages: "Generator[bytes]", myserver: Generator) -> None:
"""
Client will send messages to the server, and the server will send them back.
"""
Expand Down
9 changes: 6 additions & 3 deletions network/test_udp.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import os
from pathlib import Path
import struct
from typing import Generator
from typing import Any, Generator

import numpy as np
import pytest
Expand All @@ -25,6 +25,7 @@ def test_messages() -> "Generator[bytes]":
"""
Test messages to send to server.
"""

yield [
b"Hello world!",
np.random.bytes(4096),
Expand All @@ -33,10 +34,11 @@ def test_messages() -> "Generator[bytes]":


@pytest.fixture
def myserver(xprocess):
def myserver(xprocess: Any) -> Generator:
"""
Starts server.
"""

myenv = os.environ.copy()
myenv["PYTHONPATH"] = str(ROOT_DIR)
myenv["PYTHONUNBUFFERED"] = "1"
Expand All @@ -45,6 +47,7 @@ class Starter(ProcessStarter):
"""
xprocess config to start the server as another process.
"""

pattern = f"Listening for external data on port {SERVER_PORT}"
timeout = 60
args = ["python", "-m", "network.start_udp_receiver"]
Expand All @@ -58,7 +61,7 @@ class Starter(ProcessStarter):


# pylint: disable=W0621,W0613
def test_client(test_messages, myserver) -> int:
def test_client(test_messages: "Generator[bytes]", myserver: Generator) -> None:
"""
Client will send messages to the server.
We do not know whether they have been received successfully or not, since these are UDP packets
Expand Down

0 comments on commit f7c474a

Please sign in to comment.