From f6eb383caf873050acb3be04c17d206d05be8f4f Mon Sep 17 00:00:00 2001 From: Walter Boring Date: Fri, 27 Mar 2026 10:13:55 -0400 Subject: [PATCH] fix: Update test to work with singleton pattern The APRSISDriver uses @singleton decorator which transforms the class into a function. The test was incorrectly trying to use __new__ which doesn't work with decorated singletons. Instead, re-initialize the existing instance after changing the config. --- tests/client/drivers/test_aprsis_driver.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/client/drivers/test_aprsis_driver.py b/tests/client/drivers/test_aprsis_driver.py index c65ad87..63eec8f 100644 --- a/tests/client/drivers/test_aprsis_driver.py +++ b/tests/client/drivers/test_aprsis_driver.py @@ -83,11 +83,11 @@ class TestAPRSISDriver(unittest.TestCase): # Set a custom stale_timeout self.mock_conf.aprs_network.stale_timeout = 60 # 1 minute - # Create a new driver instance with custom timeout - driver = APRSISDriver.__new__(APRSISDriver) - driver.__init__() + # Re-initialize the existing driver with new config + # (singleton pattern means we can't create a new instance) + self.driver.__init__() - self.assertEqual(driver.max_delta, datetime.timedelta(seconds=60)) + self.assertEqual(self.driver.max_delta, datetime.timedelta(seconds=60)) def test_is_enabled_true(self): """Test is_enabled returns True when APRS-IS is enabled."""