test_form_network fails with zigpy 0.50.3
mweinelt opened this issue · comments
After upgrading zigpy to 0.50.3 we're seeing the following test case fail.
______________________________ test_form_network _______________________________
app = <zigpy_xbee.zigbee.application.ControllerApplication object at 0x7ffff5310f10>
async def test_form_network(app):
legacy_module = False
async def mock_at_command(cmd, *args):
if cmd == "MY":
return 0x0000
elif cmd == "WR":
app._api.coordinator_started_event.set()
elif cmd == "CE" and legacy_module:
raise RuntimeError
return None
app._api._at_command = mock.MagicMock(
spec=XBee._at_command, side_effect=mock_at_command
)
app._api._queued_at = mock.MagicMock(
spec=XBee._at_command, side_effect=mock_at_command
)
app._get_association_state = mock.AsyncMock(
spec=application.ControllerApplication._get_association_state,
return_value=0x00,
)
app.write_network_info = mock.MagicMock(wraps=app.write_network_info)
> await app.form_network()
tests/test_application.py:264:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/nix/store/1w2yfik564svfwg1wbvvlxp0pdqjddwr-python3.10-zigpy-0.50.3/lib/python3.10/site-packages/zigpy/application.py:211: in form_network
await self.backups.restore_backup(
/nix/store/1w2yfik564svfwg1wbvvlxp0pdqjddwr-python3.10-zigpy-0.50.3/lib/python3.10/site-packages/zigpy/backups.py:162: in restore_backup
await self.create_backup()
/nix/store/1w2yfik564svfwg1wbvvlxp0pdqjddwr-python3.10-zigpy-0.50.3/lib/python3.10/site-packages/zigpy/backups.py:128: in create_backup
await self.app.load_network_info(load_devices=load_devices)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <zigpy_xbee.zigbee.application.ControllerApplication object at 0x7ffff5310f10>
async def load_network_info(self, *, load_devices=False):
# Load node info
node_info = self.state.node_info
node_info.nwk = zigpy.types.NWK(await self._api._at_command("MY"))
serial_high = await self._api._at_command("SH")
serial_low = await self._api._at_command("SL")
node_info.ieee = zigpy.types.EUI64(
> (serial_high.to_bytes(4, "big") + serial_low.to_bytes(4, "big"))[::-1]
)
E AttributeError: 'NoneType' object has no attribute 'to_bytes'
zigpy_xbee/zigbee/application.py:110: AttributeError