mirror of
https://github.com/OMGeeky/homecontrol.esp-sensors.git
synced 2026-01-03 01:52:26 +01:00
refactor: clean up imports in MQTT modules and tests
This commit is contained in:
@@ -7,30 +7,11 @@ It supports both real hardware and simulation mode.
|
||||
This module uses the MQTTClient class from mqtt_client.py for the core MQTT implementation.
|
||||
"""
|
||||
|
||||
import time
|
||||
import json
|
||||
import time
|
||||
|
||||
from .mqtt_client import (
|
||||
MQTTClient,
|
||||
MQTTException,
|
||||
CONNECT,
|
||||
CONNACK,
|
||||
PUBLISH,
|
||||
PUBACK,
|
||||
SUBSCRIBE,
|
||||
SUBACK,
|
||||
UNSUBSCRIBE,
|
||||
UNSUBACK,
|
||||
PINGREQ,
|
||||
PINGRESP,
|
||||
DISCONNECT,
|
||||
CONN_ACCEPTED,
|
||||
CONN_REFUSED_PROTOCOL,
|
||||
CONN_REFUSED_IDENTIFIER,
|
||||
CONN_REFUSED_SERVER,
|
||||
CONN_REFUSED_USER_PASS,
|
||||
CONN_REFUSED_AUTH,
|
||||
MQTT_PROTOCOL_LEVEL,
|
||||
MQTT_CLEAN_SESSION,
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -7,10 +7,9 @@ and provides a simple interface for connecting to an MQTT broker, publishing
|
||||
messages, and subscribing to topics.
|
||||
"""
|
||||
|
||||
import time
|
||||
import json
|
||||
import socket
|
||||
import struct
|
||||
import time
|
||||
|
||||
# MQTT Protocol Constants
|
||||
MQTT_PROTOCOL_LEVEL = 4 # MQTT 3.1.1
|
||||
|
||||
@@ -2,10 +2,11 @@
|
||||
Tests for the MQTT module.
|
||||
"""
|
||||
|
||||
import pytest
|
||||
import json
|
||||
from unittest.mock import patch, MagicMock
|
||||
from src.esp_sensors.mqtt_client import MQTTClient
|
||||
|
||||
import pytest
|
||||
|
||||
from src.esp_sensors.mqtt import setup_mqtt, publish_sensor_data
|
||||
|
||||
|
||||
|
||||
@@ -4,25 +4,19 @@ Tests for the MQTT Client module.
|
||||
This module contains tests for the MQTTClient class in the mqtt_client.py module.
|
||||
"""
|
||||
|
||||
import struct
|
||||
import time
|
||||
from unittest.mock import patch, MagicMock
|
||||
|
||||
import pytest
|
||||
import socket
|
||||
import struct
|
||||
from unittest.mock import patch, MagicMock, call
|
||||
|
||||
from src.esp_sensors.mqtt_client import (
|
||||
MQTTClient,
|
||||
MQTTException,
|
||||
CONNECT,
|
||||
CONNACK,
|
||||
PUBLISH,
|
||||
PUBACK,
|
||||
SUBSCRIBE,
|
||||
SUBACK,
|
||||
PINGREQ,
|
||||
PINGRESP,
|
||||
DISCONNECT,
|
||||
CONN_ACCEPTED,
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user