From a95e641d110cf40dc54fa0f293347a36b218b18f Mon Sep 17 00:00:00 2001 From: Jan <154529400+djchhp@users.noreply.github.com> Date: Thu, 7 Mar 2024 12:49:13 +0100 Subject: [PATCH] MQTT fixed * Fixing paho-mqtt version * livetime management mqtt client in fixture Signed-off-by: Jan <154529400+djchhp@users.noreply.github.com> --- everest-testing/setup.cfg | 2 +- everest-testing/src/everest/testing/core_utils/fixtures.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/everest-testing/setup.cfg b/everest-testing/setup.cfg index 779fb14b..99a3bbc5 100644 --- a/everest-testing/setup.cfg +++ b/everest-testing/setup.cfg @@ -17,7 +17,7 @@ install_requires = pytest pytest-asyncio python-dateutil - paho-mqtt + paho-mqtt ==1.6.1 pyftpdlib ocpp websockets diff --git a/everest-testing/src/everest/testing/core_utils/fixtures.py b/everest-testing/src/everest/testing/core_utils/fixtures.py index ae93f3da..c2271552 100644 --- a/everest-testing/src/everest/testing/core_utils/fixtures.py +++ b/everest-testing/src/everest/testing/core_utils/fixtures.py @@ -123,8 +123,10 @@ def test_controller(request, tmp_path, everest_core) -> EverestTestController: def connected_mqtt_client(everest_core: EverestCore) -> mqtt.Client: mqtt_server_uri = os.environ.get("MQTT_SERVER_ADDRESS", "127.0.0.1") mqtt_server_port = int(os.environ.get("MQTT_SERVER_PORT", "1883")) - client = mqtt.Client(mqtt.CallbackAPIVersion.VERSION2, everest_core.everest_uuid) + client = mqtt.Client(everest_core.everest_uuid) client.connect(mqtt_server_uri, mqtt_server_port) client.loop_start() - return client + yield client + + client.loop_stop()