Skip to content

Commit

Permalink
fix: make tests compatible with habluetooth>=3
Browse files Browse the repository at this point in the history
And require habluetooth>=3.0, which introduced the API change.

Closes: #38
  • Loading branch information
mweinelt committed Jun 6, 2024
1 parent 7140d64 commit 81abfe8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ packages = [

[tool.poetry.dependencies]
python = ">=3.11,<3.13"
habluetooth = ">=0.11.0"
habluetooth = ">=3.0"

[tool.poetry.group.dev.dependencies]
pytest = "^7.0"
Expand Down
6 changes: 6 additions & 0 deletions tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ def test_model_from_scanner():
"service_uuids": ["cba20d00-224d-11e6-9fb8-0002a5d5c51b"],
"source": "local",
"time": now,
"tx_power": -127,
}


Expand All @@ -109,6 +110,7 @@ def test_construct_service_info_bleak():
advertisement=switchbot_adv,
connectable=False,
time=now,
tx_power=None,
)

assert service_info.service_uuids == ["cba20d00-224d-11e6-9fb8-0002a5d5c51b"]
Expand All @@ -132,6 +134,7 @@ def test_construct_service_info_bleak():
"service_uuids": ["cba20d00-224d-11e6-9fb8-0002a5d5c51b"],
"source": "local",
"time": now,
"tx_power": None,
}


Expand Down Expand Up @@ -165,6 +168,7 @@ def test_from_device_and_advertisement_data():
"service_uuids": ["cba20d00-224d-11e6-9fb8-0002a5d5c51b"],
"source": "local",
"time": now_monotonic,
"tx_power": -127,
}


Expand Down Expand Up @@ -200,6 +204,7 @@ class pyobjc_int(int):
advertisement=switchbot_adv,
connectable=False,
time=now,
tx_power=None,
)

assert service_info.service_uuids == ["cba20d00-224d-11e6-9fb8-0002a5d5c51b"]
Expand All @@ -223,4 +228,5 @@ class pyobjc_int(int):
"service_uuids": ["cba20d00-224d-11e6-9fb8-0002a5d5c51b"],
"source": "local",
"time": now,
"tx_power": None,
}

0 comments on commit 81abfe8

Please sign in to comment.