From fc7be8aa00fa0877f84678bd45dd91da4726e064 Mon Sep 17 00:00:00 2001 From: Allen Porter Date: Fri, 22 Oct 2021 21:33:40 -0700 Subject: [PATCH] Fix a bug in a nest test that causes side effects for other tests (#58264) Fix a bug where a constant configuration variable in the common test library is modified during the test, causing side effects for other tests. This was found by renaming the tests, which caused other tests to fail. --- tests/components/nest/test_init_sdm.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/components/nest/test_init_sdm.py b/tests/components/nest/test_init_sdm.py index db5e0c2fc33..205cc34fe20 100644 --- a/tests/components/nest/test_init_sdm.py +++ b/tests/components/nest/test_init_sdm.py @@ -5,6 +5,7 @@ The tests fake out the subscriber/devicemanager and simulate setup behavior and failure modes. """ +import copy import logging from unittest.mock import patch @@ -41,7 +42,7 @@ async def async_setup_sdm(hass, config=CONFIG): async def test_setup_configuration_failure(hass, caplog): """Test configuration error.""" - config = CONFIG.copy() + config = copy.deepcopy(CONFIG) config[DOMAIN]["subscriber_id"] = "invalid-subscriber-format" result = await async_setup_sdm(hass, config) @@ -107,7 +108,7 @@ async def test_subscriber_auth_failure(hass, caplog): async def test_setup_missing_subscriber_id(hass, caplog): """Test successful setup.""" - config = CONFIG + config = copy.deepcopy(CONFIG) del config[DOMAIN]["subscriber_id"] with caplog.at_level(logging.ERROR, logger="homeassistant.components.nest"): result = await async_setup_sdm(hass, config)