From 3f2fc2fce94c5cab71484f31e4c5a63cccee42e1 Mon Sep 17 00:00:00 2001 From: Jan Bouwhuis Date: Fri, 15 Dec 2023 08:15:10 +0100 Subject: [PATCH] Fix mqtt tests modifying globals (#105774) --- tests/components/mqtt/test_cover.py | 3 ++- tests/components/mqtt/test_select.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/components/mqtt/test_cover.py b/tests/components/mqtt/test_cover.py index 8db1c89bc40..c1732003fc0 100644 --- a/tests/components/mqtt/test_cover.py +++ b/tests/components/mqtt/test_cover.py @@ -1,4 +1,5 @@ """The tests for the MQTT cover platform.""" +from copy import deepcopy from typing import Any from unittest.mock import patch @@ -3582,7 +3583,7 @@ async def test_publishing_with_custom_encoding( ) -> None: """Test publishing MQTT payload with different encoding.""" domain = cover.DOMAIN - config = DEFAULT_CONFIG + config = deepcopy(DEFAULT_CONFIG) config[mqtt.DOMAIN][domain]["position_topic"] = "some-position-topic" await help_test_publishing_with_custom_encoding( diff --git a/tests/components/mqtt/test_select.py b/tests/components/mqtt/test_select.py index 0c18881d86e..030f5a2ac9a 100644 --- a/tests/components/mqtt/test_select.py +++ b/tests/components/mqtt/test_select.py @@ -707,7 +707,7 @@ async def test_publishing_with_custom_encoding( ) -> None: """Test publishing MQTT payload with different encoding.""" domain = select.DOMAIN - config = DEFAULT_CONFIG + config = copy.deepcopy(DEFAULT_CONFIG) config[mqtt.DOMAIN][domain]["options"] = ["milk", "beer"] await help_test_publishing_with_custom_encoding(