Merge branch 'add_python310_support' into replace_docopts

pull/168/head
Andrew Mirsky 2025-05-19 13:09:20 -04:00
commit 582f8b16c7
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: A98E67635CDF2C39
5 zmienionych plików z 17 dodań i 5 usunięć

Wyświetl plik

@ -1,4 +1,4 @@
\# Contributing to aMQTT
# Contributing to aMQTT
:+1::tada: First off, thanks for taking the time to contribute! :tada::+1:

Wyświetl plik

@ -429,10 +429,10 @@ class Broker:
await writer.close()
raise MQTTError(exc) from exc
except NoDataError as exc:
self.logger.error( # noqa: TRY400 # cannot replace with exception else pytest fails
self.logger.error( # noqa: TRY400
f"No data from {format_client_message(address=remote_address, port=remote_port)} : {exc}",
)
raise NoDataError(exc) from exc
raise AMQTTError(exc) from exc
if client_session.clean_session:
# Delete existing session and create a new one

Wyświetl plik

@ -1,4 +1,5 @@
import asyncio
from collections import deque # pylint: disable=C0412
from typing import SupportsIndex, SupportsInt # pylint: disable=C0412
try:

Wyświetl plik

@ -153,6 +153,7 @@ addopts = ["--cov=amqtt", "--cov-report=term-missing", "--cov-report=xml"]
testpaths = ["tests"]
asyncio_mode = "auto"
timeout = 10
asyncio_default_fixture_loop_scope = "function"
# log_cli = true
# log_level = "INFO"

Wyświetl plik

@ -114,12 +114,20 @@ async def test_client_connect(broker, mock_plugin_manager):
async def test_connect_tcp(broker):
process = psutil.Process()
connections_number = 10
sockets = [socket.create_connection(("127.0.0.1", 1883)) for _ in range(connections_number)]
# mqtt 3.1 requires a connect packet, otherwise the socket connection is rejected
static_connect_packet = b'\x10\x1b\x00\x04MQTT\x04\x02\x00<\x00\x0ftest-client-123'
sockets = []
for i in range(connections_number):
s = socket.create_connection(("127.0.0.1", 1883))
s.send(static_connect_packet)
sockets.append(s)
# Wait for a brief moment to ensure connections are established
await asyncio.sleep(0.1)
# Get the current number of TCP connections
# # Get the current number of TCP connections
connections = process.net_connections()
# max number of connections on the TCP listener is 10
@ -151,6 +159,8 @@ async def test_connect_tcp(broker):
# Add one more connection to the TCP listener
s = socket.create_connection(("127.0.0.1", 1883))
s.send(static_connect_packet)
open_connections = []
open_connections = [conn for conn in process.net_connections() if conn.status == "ESTABLISHED"]