Skip to content

Commit 135346b

Browse files
authored
Merge pull request #207 from puddly/rc
0.19.0 Release
2 parents 9b595f5 + 382150e commit 135346b

File tree

14 files changed

+611
-660
lines changed

14 files changed

+611
-660
lines changed

.github/workflows/ci.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77

88
env:
99
CACHE_VERSION: 1
10-
DEFAULT_PYTHON: 3.7
10+
DEFAULT_PYTHON: 3.8
1111
PRE_COMMIT_HOME: ~/.cache/pre-commit
1212

1313
jobs:
@@ -18,7 +18,7 @@ jobs:
1818
runs-on: ubuntu-latest
1919
strategy:
2020
matrix:
21-
python-version: [3.7, 3.8, 3.9]
21+
python-version: [3.8, 3.9, "3.10"]
2222
steps:
2323
- name: Check out code from GitHub
2424
uses: actions/checkout@v2
@@ -35,7 +35,7 @@ jobs:
3535
key: >-
3636
${{ env.CACHE_VERSION}}-${{ runner.os }}-base-venv-${{
3737
steps.python.outputs.python-version }}-${{
38-
hashFiles('requirements_test.txt') }}
38+
hashFiles('requirements_test.txt', 'setup.py') }}
3939
restore-keys: |
4040
${{ env.CACHE_VERSION}}-${{ runner.os }}-base-venv-${{ steps.python.outputs.python-version }}-
4141
- name: Create Python virtual environment
@@ -67,7 +67,7 @@ jobs:
6767
key: >-
6868
${{ env.CACHE_VERSION}}-${{ runner.os }}-base-venv-${{
6969
steps.python.outputs.python-version }}-${{
70-
hashFiles('requirements_test.txt') }}
70+
hashFiles('requirements_test.txt', 'setup.py') }}
7171
- name: Fail job if Python cache restore failed
7272
if: steps.cache-venv.outputs.cache-hit != 'true'
7373
run: |
@@ -108,7 +108,7 @@ jobs:
108108
key: >-
109109
${{ env.CACHE_VERSION}}-${{ runner.os }}-base-venv-${{
110110
steps.python.outputs.python-version }}-${{
111-
hashFiles('requirements_test.txt') }}
111+
hashFiles('requirements_test.txt', 'setup.py') }}
112112
- name: Fail job if Python cache restore failed
113113
if: steps.cache-venv.outputs.cache-hit != 'true'
114114
run: |
@@ -151,7 +151,7 @@ jobs:
151151
key: >-
152152
${{ env.CACHE_VERSION}}-${{ runner.os }}-base-venv-${{
153153
steps.python.outputs.python-version }}-${{
154-
hashFiles('requirements_test.txt') }}
154+
hashFiles('requirements_test.txt', 'setup.py') }}
155155
- name: Fail job if Python cache restore failed
156156
if: steps.cache-venv.outputs.cache-hit != 'true'
157157
run: |
@@ -197,7 +197,7 @@ jobs:
197197
key: >-
198198
${{ env.CACHE_VERSION}}-${{ runner.os }}-base-venv-${{
199199
steps.python.outputs.python-version }}-${{
200-
hashFiles('requirements_test.txt') }}
200+
hashFiles('requirements_test.txt', 'setup.py') }}
201201
- name: Fail job if Python cache restore failed
202202
if: steps.cache-venv.outputs.cache-hit != 'true'
203203
run: |
@@ -240,7 +240,7 @@ jobs:
240240
key: >-
241241
${{ env.CACHE_VERSION}}-${{ runner.os }}-base-venv-${{
242242
steps.python.outputs.python-version }}-${{
243-
hashFiles('requirements_test.txt') }}
243+
hashFiles('requirements_test.txt', 'setup.py') }}
244244
- name: Fail job if Python cache restore failed
245245
if: steps.cache-venv.outputs.cache-hit != 'true'
246246
run: |
@@ -271,7 +271,7 @@ jobs:
271271
needs: prepare-base
272272
strategy:
273273
matrix:
274-
python-version: [3.7, 3.8, 3.9]
274+
python-version: [3.8, 3.9, "3.10"]
275275
name: >-
276276
Run tests Python ${{ matrix.python-version }}
277277
steps:
@@ -290,7 +290,7 @@ jobs:
290290
key: >-
291291
${{ env.CACHE_VERSION}}-${{ runner.os }}-base-venv-${{
292292
steps.python.outputs.python-version }}-${{
293-
hashFiles('requirements_test.txt') }}
293+
hashFiles('requirements_test.txt', 'setup.py') }}
294294
- name: Fail job if Python cache restore failed
295295
if: steps.cache-venv.outputs.cache-hit != 'true'
296296
run: |
@@ -353,7 +353,7 @@ jobs:
353353
key: >-
354354
${{ env.CACHE_VERSION}}-${{ runner.os }}-base-venv-${{
355355
steps.python.outputs.python-version }}-${{
356-
hashFiles('requirements_test.txt') }}
356+
hashFiles('requirements_test.txt', 'setup.py') }}
357357
- name: Fail job if Python cache restore failed
358358
if: steps.cache-venv.outputs.cache-hit != 'true'
359359
run: |

.github/workflows/publish-to-pypi.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- uses: actions/checkout@master
13-
- name: Set up Python 3.7
13+
- name: Set up Python 3.8
1414
uses: actions/setup-python@v1
1515
with:
16-
version: 3.7
16+
version: 3.8
1717
- name: Install wheel
1818
run: >-
1919
pip install wheel

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@
2121
author_email="[email protected]",
2222
license="GPL-3.0",
2323
packages=find_packages(exclude=["tests"]),
24-
install_requires=["pyserial-asyncio", "zigpy>=0.47.0"],
25-
tests_require=["pytest", "pytest-asyncio>=0.17", "asynctest"],
24+
install_requires=["zigpy>=0.51.0"],
25+
tests_require=["pytest", "asynctest"],
2626
)

tests/test_api.py

Lines changed: 79 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def _fake_args(arg_type):
149149
return list(arg_type)[0] # Pick the first enum value
150150
elif issubclass(arg_type, t.DeconzAddressEndpoint):
151151
addr = t.DeconzAddressEndpoint()
152-
addr.address_mode = t.ADDRESS_MODE.NWK
152+
addr.address_mode = t.AddressMode.NWK
153153
addr.address = t.uint8_t(0)
154154
addr.endpoint = t.uint8_t(0)
155155
return addr
@@ -242,11 +242,34 @@ async def test_aps_data_confirm(api, monkeypatch):
242242

243243
success = True
244244

245-
def mock_cmd(*args, **kwargs):
246-
res = asyncio.Future()
247-
if success:
248-
res.set_result([7, 0x22, 0x11, sentinel.dst_addr, 1, 0x00, 0, 0, 0, 0])
249-
return asyncio.wait_for(res, timeout=deconz_api.COMMAND_TIMEOUT)
245+
async def mock_cmd(*args, **kwargs):
246+
if not success:
247+
raise asyncio.TimeoutError()
248+
249+
dst = t.DeconzAddressEndpoint()
250+
dst.address_mode = t.AddressMode.NWK
251+
dst.address = 0x26FF
252+
dst.endpoint = 1
253+
254+
rsp = [
255+
12,
256+
(
257+
deconz_api.DeviceState.APSDE_DATA_REQUEST_SLOTS_AVAILABLE
258+
| deconz_api.DeviceState.APSDE_DATA_INDICATION
259+
| deconz_api.DeviceState.APSDE_DATA_CONFIRM
260+
| 2
261+
),
262+
98,
263+
dst,
264+
1,
265+
deconz_api.TXStatus.SUCCESS,
266+
0,
267+
0,
268+
0,
269+
0,
270+
]
271+
api._handle_aps_data_confirm(rsp)
272+
return rsp
250273

251274
api._command = mock_cmd
252275
api._data_confirm = True
@@ -586,3 +609,53 @@ async def test_connection_lost(api):
586609
api.connection_lost(err)
587610

588611
app.connection_lost.assert_called_once_with(err)
612+
613+
614+
async def test_aps_data_indication(api):
615+
dst = t.DeconzAddress()
616+
dst.address_mode = t.AddressMode.NWK
617+
dst.address = 0x0000
618+
619+
src = t.DeconzAddress()
620+
src.address_mode = t.AddressMode.NWK
621+
src.address = 0xC643
622+
623+
data = b"\x18\x1f\x01\x04\x00\x00B\x12Third Reality, Inc\x05\x00\x00B\t3RSP019BZ"
624+
625+
packet = [
626+
63,
627+
(deconz_api.DeviceState.APSDE_DATA_REQUEST_SLOTS_AVAILABLE | 2),
628+
dst,
629+
1,
630+
src,
631+
1,
632+
260,
633+
0,
634+
data,
635+
0,
636+
175,
637+
255,
638+
186,
639+
25,
640+
78,
641+
3,
642+
-47,
643+
]
644+
645+
api._handle_aps_data_indication(packet)
646+
647+
api._app.handle_rx.assert_called_once_with(
648+
src=src,
649+
src_ep=1,
650+
dst=dst,
651+
dst_ep=1,
652+
profile_id=260,
653+
cluster_id=0x0000,
654+
data=data,
655+
lqi=255,
656+
rssi=-47,
657+
)
658+
659+
# No error is thrown when the app is disconnected
660+
api._app = None
661+
api._handle_aps_data_indication(packet)

0 commit comments

Comments
 (0)