Skip to content

Commit

Permalink
Merge pull request #516 from zigpy/rc
Browse files Browse the repository at this point in the history
0.34.5 Release
  • Loading branch information
puddly committed Nov 29, 2022
2 parents 848f26e + b88d652 commit f455ee4
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 22 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8, 3.9, "3.10"]
python-version: [3.8, 3.9, "3.10", "3.11"]
steps:
- name: Check out code from GitHub
uses: actions/checkout@v2
Expand Down Expand Up @@ -283,7 +283,7 @@ jobs:
needs: prepare-base
strategy:
matrix:
python-version: [3.8, 3.9, "3.10"]
python-version: [3.8, 3.9, "3.10", "3.11"]
name: >-
Run tests Python ${{ matrix.python-version }}
steps:
Expand Down
2 changes: 1 addition & 1 deletion bellows/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
MAJOR_VERSION = 0
MINOR_VERSION = 34
PATCH_VERSION = "4"
PATCH_VERSION = "5"
__short_version__ = f"{MAJOR_VERSION}.{MINOR_VERSION}"
__version__ = f"{__short_version__}.{PATCH_VERSION}"
12 changes: 1 addition & 11 deletions bellows/types/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,17 +208,7 @@ def __call__(cls, value, names=None, *args, **kwargs): # noqa: N805
def enum_factory(int_type: CALLABLE_T, undefined: str = "undefined") -> CALLABLE_T:
"""Enum factory."""

class _NewEnum(enum.IntEnum, metaclass=_IntEnumMeta):
def serialize(self):
"""Serialize enum."""
return int_type(self.value).serialize()

@classmethod
def deserialize(cls, data: bytes) -> (bytes, bytes):
"""Deserialize data."""
val, data = int_type.deserialize(data)
return cls(val), data

class _NewEnum(int_type, enum.Enum, metaclass=_IntEnumMeta):
@classmethod
def _missing_(cls, value):
new = int_type.__new__(cls, value)
Expand Down
7 changes: 7 additions & 0 deletions bellows/uart.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,15 @@ def _reset_cleanup(self, future):
"""Delete reset future."""
self._reset_future = None

def eof_received(self):
"""Server gracefully closed its side of the connection."""
self.connection_lost(OSError("Server closed connection"))

def connection_lost(self, exc):
"""Port was closed unexpectedly."""

LOGGER.debug("Connection lost: %r", exc)

if self._connection_done_future:
self._connection_done_future.set_result(exc)
self._connection_done_future = None
Expand Down
2 changes: 1 addition & 1 deletion bellows/zigbee/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def zigpy_key_to_ezsp_key(zigpy_key: zigpy.state.Key, ezsp):
key.bitmask |= ezsp.types.EmberKeyStructBitmask.KEY_HAS_OUTGOING_FRAME_COUNTER

if zigpy_key.rx_counter is not None:
key.outgoingFrameCounter = t.uint32_t(zigpy_key.rx_counter)
key.incomingFrameCounter = t.uint32_t(zigpy_key.rx_counter)
key.bitmask |= ezsp.types.EmberKeyStructBitmask.KEY_HAS_INCOMING_FRAME_COUNTER

if zigpy_key.partner_ieee is not None:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"click-log>=0.2.1",
"pure_pcapy3==1.0.1",
"voluptuous",
"zigpy>=0.51.0",
"zigpy>=0.52.0",
],
dependency_links=[
"https://codeload.github.com/rcloran/pure-pcapy-3/zip/master",
Expand Down
6 changes: 2 additions & 4 deletions tests/test_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -705,9 +705,7 @@ async def test_send_packet_unicast_ieee_no_fallback(app, packet, caplog):
async def test_send_packet_unicast_source_route_ezsp7(make_app, packet):
app = make_app({zigpy.config.CONF_SOURCE_ROUTING: True})
app._ezsp.ezsp_version = 7
app._ezsp.setSourceRoute = AsyncMock(
spec_set=app._ezsp.setSourceRoute, return_value=(t.EmberStatus.SUCCESS,)
)
app._ezsp.setSourceRoute = AsyncMock(return_value=(t.EmberStatus.SUCCESS,))

packet.source_route = [0x0001, 0x0002]
await _test_send_packet_unicast(app, packet)
Expand Down Expand Up @@ -778,7 +776,7 @@ async def test_send_packet_unicast_retries_failure(app, packet):


async def test_send_packet_unicast_concurrency(app, packet, monkeypatch):
monkeypatch.setattr(bellows.zigbee.application, "APS_ACK_TIMEOUT", 0.1)
monkeypatch.setattr(bellows.zigbee.application, "APS_ACK_TIMEOUT", 0.5)

app._concurrent_requests_semaphore.max_value = 10

Expand Down
6 changes: 6 additions & 0 deletions tests/test_uart.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,12 @@ def test_connection_closed(gw):
assert gw._application.connection_lost.call_count == 0


def test_eof_received(gw):
gw.eof_received()

assert gw._application.connection_lost.call_count == 1


async def test_connection_lost_reset_error_propagation(monkeypatch):
app = MagicMock()
transport = MagicMock()
Expand Down
4 changes: 2 additions & 2 deletions tests/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ def test_zha_security_hashed_nonstandard_tclk_warning(network_info, node_info, c


def test_ezsp_key_to_zigpy_key(zigpy_key, ezsp_key, ezsp_mock):
return util.ezsp_key_to_zigpy_key(ezsp_key, ezsp_mock) == zigpy_key
assert util.ezsp_key_to_zigpy_key(ezsp_key, ezsp_mock) == zigpy_key


def test_zigpy_key_to_ezsp_key(zigpy_key, ezsp_key, ezsp_mock):
return util.zigpy_key_to_ezsp_key(zigpy_key, ezsp_mock) == ezsp_key
assert util.zigpy_key_to_ezsp_key(zigpy_key, ezsp_mock) == ezsp_key

0 comments on commit f455ee4

Please sign in to comment.