Skip to content

Skip SMSD tests when database driver unavailable - #191

Merged
nijel merged 3 commits into
masterfrom
copilot/skip-database-tests
Feb 5, 2026
Merged

Skip SMSD tests when database driver unavailable#191
nijel merged 3 commits into
masterfrom
copilot/skip-database-tests

Conversation

Copilot AI commented Feb 5, 2026

Copy link
Copy Markdown
Contributor

SMSD tests fail when Gammu is built without SQLite support (e.g., PostgreSQL-only builds), throwing ERR_UNKNOWN from SMSD_ReadConfig due to hardcoded SQLite driver in test config.

Changes

  • Probe SMSD initialization in setUp() and skip test class when driver unavailable
  • Detect driver errors by checking SMSD_ReadConfig location or error codes 27/75
  • Import gammu module for GSMError exception handling
# Check if SMSD with SQLite driver is available
try:
    smsd = gammu.smsd.SMSD(self.config_name)
    del smsd
except gammu.GSMError as exc:
    error_info = exc.args[0] if exc.args else {}
    if error_info.get("Where") == "SMSD_ReadConfig" or error_info.get("Code") in (27, 75):
        raise unittest.SkipTest("SMSD initialization failed (Gammu may be built without required database driver support)")
    raise

Tests now skip gracefully instead of failing on systems with different Gammu database driver configurations.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • esm.ubuntu.com
    • Triggering command: /usr/lib/apt/methods/https /usr/lib/apt/methods/https (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Skip Database tests or make it more correct</issue_title>
<issue_description>Installed gammu 1.38.5/1.40.1, builded with postgresql. But python-gammu 2.12 fail tests:

test_inject (test.test_smsd.SMSDDummyTest) ... Fri 2019/11/01 15:50:09 python-gammu[23837]: Using SQL service
Fri 2019/11/01 15:50:09 python-gammu[23837]: Configuring Gammu SMSD...
Fri 2019/11/01 15:50:09 python-gammu[23837]: SHM token: 0x103715e (17002846)
Fri 2019/11/01 15:50:09 python-gammu[23837]: Warning: No PIN code in /var/calculate/tmp/portage/dev-python/python-gammu-2.12/temp/tmployHVJ/.gammurc file
Fri 2019/11/01 15:50:09 python-gammu[23837]: CommTimeout=1, SendTimeout=30, ReceiveFrequency=15, ResetFrequency=0, HardResetFrequency=0
Fri 2019/11/01 15:50:09 python-gammu[23837]: checks: CheckSecurity=1, CheckBattery=1, CheckSignal=1, CheckNetwork=1
Fri 2019/11/01 15:50:09 python-gammu[23837]: mode: Send=1, Receive=1
Fri 2019/11/01 15:50:09 python-gammu[23837]: deliveryreport = no
Fri 2019/11/01 15:50:09 python-gammu[23837]: phoneid = 
Fri 2019/11/01 15:50:09 python-gammu[23837]: Unknown DB driver
ERROR

(twice)

======================================================================
ERROR: test_inject (test.test_smsd.SMSDDummyTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/var/calculate/tmp/portage/dev-python/python-gammu-2.12/work/python-gammu-2.12/test/test_smsd.py", line 91, in test_inject
    smsd = self.get_smsd()
  File "/var/calculate/tmp/portage/dev-python/python-gammu-2.12/work/python-gammu-2.12/test/test_smsd.py", line 85, in get_smsd
    return gammu.smsd.SMSD(self.config_name)
ERR_UNKNOWN: {'Text': u'Unknown error.', 'Code': 27, 'Where': 'SMSD_ReadConfig'}

(twice too)

FAILED (errors=2)
Test failed: <unittest.runner.TextTestResult run=50 errors=2 failures=0>
python-gammu: WARNING: Adding USSD to queue, position 0
Gammu version (1, 40, 0), SMSD DB version 17
Gammu version (1, 40, 0), SMSD DB version 17
Log filename is "stderr"
Gammu version (1, 40, 0), SMSD DB version 17
Log filename is "stderr"
error: Test failed: <unittest.runner.TextTestResult run=50 errors=2 failures=0>

With 1.38.5 same result. Perhaps it's not bug, but need explanations...</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits February 5, 2026 07:06
Co-authored-by: nijel <212189+nijel@users.noreply.github.com>
…or check more robust

Co-authored-by: nijel <212189+nijel@users.noreply.github.com>
Copilot AI changed the title [WIP] Skip database tests or make them more correct Skip SMSD tests when database driver unavailable Feb 5, 2026
Copilot AI requested a review from nijel February 5, 2026 07:10
@nijel
nijel marked this pull request as ready for review February 5, 2026 07:16
@nijel
nijel merged commit af73c00 into master Feb 5, 2026
44 checks passed
@nijel
nijel deleted the copilot/skip-database-tests branch February 5, 2026 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Skip Database tests or make it more correct

2 participants