python3Packages.pysnooz: fix bleak 1.0.0 compat

This commit is contained in:
Martin Weinelt
2025-08-08 04:19:44 +02:00
parent 25f73edbe2
commit d3e1b7e11d
2 changed files with 49 additions and 5 deletions
@@ -0,0 +1,39 @@
diff --git a/tests/test_api.py b/tests/test_api.py
index 3289252..30388b2 100644
--- a/tests/test_api.py
+++ b/tests/test_api.py
@@ -25,7 +25,7 @@ DBUS_ERROR_UNKNOWN = BleakDBusError("org.bluez.Error.SomethingNotHandled", [])
@pytest.fixture()
def mock_client() -> MockSnoozClient:
return MockSnoozClient(
- BLEDevice("Snooz-ABCD", "00:00:00:00:12:34", [], 0), SnoozDeviceModel.ORIGINAL
+ BLEDevice("Snooz-ABCD", "00:00:00:00:12:34", []), SnoozDeviceModel.ORIGINAL
)
diff --git a/tests/test_device.py b/tests/test_device.py
index f24a7c6..38240e4 100644
--- a/tests/test_device.py
+++ b/tests/test_device.py
@@ -127,7 +127,7 @@ def snooz(
model_name = (
MODEL_NAME_BREEZ if model == SnoozDeviceModel.BREEZ else MODEL_NAME_SNOOZ
)
- device = BLEDevice("AA:BB:CC:DD:EE:FF", f"{model_name}-EEFF", [], 0)
+ device = BLEDevice("AA:BB:CC:DD:EE:FF", f"{model_name}-EEFF", [])
password = "AABBCCDDEEFF"
adv_data = SnoozAdvertisementData(
model,
diff --git a/tests/test_testing.py b/tests/test_testing.py
index d8ce6f2..7a1002d 100644
--- a/tests/test_testing.py
+++ b/tests/test_testing.py
@@ -22,7 +22,7 @@ from pysnooz.testing import MockSnoozClient, MockSnoozDevice
from . import SUPPORTED_MODELS
-TEST_BLE_DEVICE = BLEDevice("00:00:00:00:AB:CD", "Snooz-ABCD", [], 0)
+TEST_BLE_DEVICE = BLEDevice("00:00:00:00:AB:CD", "Snooz-ABCD", [])
@pytest.mark.asyncio
@@ -20,7 +20,7 @@
buildPythonPackage rec {
pname = "pysnooz";
version = "0.10.0";
format = "pyproject";
pyproject = true;
disabled = pythonOlder "3.9";
@@ -31,15 +31,20 @@ buildPythonPackage rec {
hash = "sha256-jOXmaJprU35sdNRrBBx/YUyiDyyaE1qodWksXkTSEe0=";
};
patches = [
# https://github.com/AustinBrunkhorst/pysnooz/pull/20
./bleak-compat.patch
];
postPatch = ''
substituteInPlace pyproject.toml \
--replace 'transitions = "^0.8.11"' 'transitions = ">=0.8.11"' \
--replace 'Events = "^0.4"' 'Events = ">=0.4"'
--replace-fail 'transitions = "^0.8.11"' 'transitions = ">=0.8.11"' \
--replace-fail 'Events = "^0.4"' 'Events = ">=0.4"'
'';
nativeBuildInputs = [ poetry-core ];
build-system = [ poetry-core ];
propagatedBuildInputs = [
dependencies = [
bleak
bleak-retry-connector
bluetooth-sensor-state-data