Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions test/test_smsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import time
import unittest

import gammu
import gammu.smsd

from .test_dummy import DummyTest
Expand Down Expand Up @@ -75,6 +76,27 @@ def setUp(self):
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", "")
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)"
)
# Re-raise if it's a different error
raise

def get_smsd(self):
return gammu.smsd.SMSD(self.config_name)

Expand Down