From bea0d52be78ff72c207b7339515dc78eb0f2e2d6 Mon Sep 17 00:00:00 2001 From: Andreas Motl Date: Sat, 19 Oct 2024 12:01:11 +0200 Subject: [PATCH 1/2] paho-mqtt: Ignore deprecation warnings about Callback API v1 --- CHANGES.rst | 1 + pytest_mqtt/capmqtt.py | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 05eca7b..9309469 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -5,6 +5,7 @@ pytest-mqtt changelog in progress =========== +- paho-mqtt: Ignore deprecation warnings about Callback API v1 2024-07-29 0.4.2 ================ diff --git a/pytest_mqtt/capmqtt.py b/pytest_mqtt/capmqtt.py index 366a2e5..bae89e0 100644 --- a/pytest_mqtt/capmqtt.py +++ b/pytest_mqtt/capmqtt.py @@ -16,6 +16,7 @@ import logging import threading import typing as t +import warnings import paho.mqtt.client as mqtt import pytest @@ -35,7 +36,9 @@ def __init__(self, on_message_callback: t.Optional[t.Callable] = None, host: str self.client = mqtt.Client() else: # paho-mqtt 2.x - self.client = mqtt.Client(mqtt.CallbackAPIVersion.VERSION1) + with warnings.catch_warnings(): + warnings.filterwarnings("ignore", category=DeprecationWarning) + self.client = mqtt.Client(mqtt.CallbackAPIVersion.VERSION1) self.on_message_callback = on_message_callback self.host = host self.port = int(port) From d04576c07d314589ba02d607c14d17eb35d7c966 Mon Sep 17 00:00:00 2001 From: Andreas Motl Date: Sat, 19 Oct 2024 12:01:44 +0200 Subject: [PATCH 2/2] mosquitto: Don't always pull OCI image --- CHANGES.rst | 1 + pytest_mqtt/mosquitto.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 9309469..3b296d7 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -6,6 +6,7 @@ pytest-mqtt changelog in progress =========== - paho-mqtt: Ignore deprecation warnings about Callback API v1 +- mosquitto: Don't always pull OCI image 2024-07-29 0.4.2 ================ diff --git a/pytest_mqtt/mosquitto.py b/pytest_mqtt/mosquitto.py index 753e94d..8118d70 100644 --- a/pytest_mqtt/mosquitto.py +++ b/pytest_mqtt/mosquitto.py @@ -57,7 +57,8 @@ def pull_image(self): """ docker_client = docker.from_env(version=self.docker_version) image_name = self.image - docker_client.images.pull(image_name) + if not docker_client.images.list(name=image_name): + docker_client.images.pull(image_name) def run(self): try: