From e2d1ba0eb7231f9826e5c75c6f8140e4af23c741 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 5 Feb 2026 06:59:51 +0000 Subject: [PATCH 1/3] Initial plan From c90b2485ebd49737c2fe43926976b3b92d1c3bd0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 5 Feb 2026 07:06:18 +0000 Subject: [PATCH 2/3] Add database driver availability check to SMSD tests Co-authored-by: nijel <212189+nijel@users.noreply.github.com> --- test/test_smsd.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/test_smsd.py b/test/test_smsd.py index 4e955ca65..6e3cf61e0 100644 --- a/test/test_smsd.py +++ b/test/test_smsd.py @@ -27,6 +27,7 @@ import time import unittest +import gammu import gammu.smsd from .test_dummy import DummyTest @@ -74,6 +75,25 @@ def setUp(self): database = sqlite3.connect(os.path.join(self.test_dir, "smsd.db")) with open(get_script()) as handle: database.executescript(handle.read()) + + # Check if SMSD with SQLite driver is available + # This will fail if Gammu was built without SQLite support + try: + smsd = gammu.smsd.SMSD(self.config_name) + # Clean up the test instance + del smsd + except gammu.GSMError as exc: + # Check if the error is related to SMSD configuration/driver + error_info = exc.args[0] if exc.args else {} + error_where = error_info.get("Where", "") + + # If error happens during SMSD_ReadConfig, it's likely a driver issue + if error_where == "SMSD_ReadConfig": + raise unittest.SkipTest( + "SMSD initialization failed (Gammu may be built without required database driver support)" + ) + # Re-raise if it's a different error + raise def get_smsd(self): return gammu.smsd.SMSD(self.config_name) From 20c4fe7ad65d8b67e0bbe91b2d435a546a9774ae Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 5 Feb 2026 07:07:12 +0000 Subject: [PATCH 3/3] Address code review feedback: remove trailing whitespace and make error check more robust Co-authored-by: nijel <212189+nijel@users.noreply.github.com> --- test/test_smsd.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/test/test_smsd.py b/test/test_smsd.py index 6e3cf61e0..ab86114ef 100644 --- a/test/test_smsd.py +++ b/test/test_smsd.py @@ -75,7 +75,7 @@ def setUp(self): database = sqlite3.connect(os.path.join(self.test_dir, "smsd.db")) with open(get_script()) as handle: database.executescript(handle.read()) - + # Check if SMSD with SQLite driver is available # This will fail if Gammu was built without SQLite support try: @@ -86,9 +86,11 @@ def setUp(self): # Check if the error is related to SMSD configuration/driver error_info = exc.args[0] if exc.args else {} error_where = error_info.get("Where", "") - - # If error happens during SMSD_ReadConfig, it's likely a driver issue - if error_where == "SMSD_ReadConfig": + error_code = error_info.get("Code", 0) + + # If error happens during SMSD_ReadConfig, it's likely a driver/config issue + # Common error codes: 27 (ERR_UNKNOWN), 75 (DB driver initialization failed) + if error_where == "SMSD_ReadConfig" or error_code in (27, 75): raise unittest.SkipTest( "SMSD initialization failed (Gammu may be built without required database driver support)" )