diff --git a/gammu/src/smsd.c b/gammu/src/smsd.c index f60e551d5..46ad99652 100644 --- a/gammu/src/smsd.c +++ b/gammu/src/smsd.c @@ -231,6 +231,9 @@ static int SMSD_init(SMSDObject * self, PyObject * args, PyObject * kwds) if (!checkError(error, "SMSD_ReadConfig")) return -1; + /* Disable exit on failure to allow Python to handle errors */ + SMSD_SetExitOnFailure(self->config, FALSE); + return 0; } diff --git a/setup.py b/setup.py index 5148d7977..bef0b0f3a 100755 --- a/setup.py +++ b/setup.py @@ -33,7 +33,7 @@ # some defines VERSION = "3.2.5" -GAMMU_REQUIRED = "1.41.0" +GAMMU_REQUIRED = "1.43.0" class GammuConfig: diff --git a/test/test_smsd.py b/test/test_smsd.py index 7ee057191..9e4d2aff3 100644 --- a/test/test_smsd.py +++ b/test/test_smsd.py @@ -141,3 +141,17 @@ def test_smsd(self) -> None: # Wait for it smsd_thread.join() + + def test_get_status_not_running(self) -> None: + """ + Test that GetStatus raises exception when SMSD is not running. + + This test verifies the fix for the issue where GetStatus would cause + Python to exit instead of raising an exception when SMSD is not running. + The fix disables the exit_on_failure flag in the SMSD config. + """ + smsd = self.get_smsd() + # SMSD is not running, so GetStatus should raise an exception + # instead of causing Python to exit + with pytest.raises(gammu.GSMError): + smsd.GetStatus()