Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@

### Build System

- Adjust actions checkout ref parameter on release
- Use an explicit checkout ref in the release workflow
([#1669](https://github.com/python-zeroconf/python-zeroconf/pull/1669),
[`bc8ec8d`](https://github.com/python-zeroconf/python-zeroconf/commit/bc8ec8d59d875522f75901644d423d30d803a030))

Expand Down Expand Up @@ -2013,17 +2013,10 @@ This also revealed that we do not send NSEC records in the initial broadcast. Th
([#1145](https://github.com/python-zeroconf/python-zeroconf/pull/1145),
[`524494e`](https://github.com/python-zeroconf/python-zeroconf/commit/524494edd49bd049726b19ae8ac8f6eea69a3943))

- Include tests and docs in sdist archives
- Ship the tests, docs and COPYING file in the sdist
([#1142](https://github.com/python-zeroconf/python-zeroconf/pull/1142),
[`da10a3b`](https://github.com/python-zeroconf/python-zeroconf/commit/da10a3b2827cee0719d3bb9152ae897f061c6e2e))

feat: Include tests and docs in sdist archives

Include documentation and test files in source distributions, in order to make them more useful for
packagers (Linux distributions, Conda). Testing is an important part of packaging process, and at
least Gentoo users have requested offline documentation for Python packages. Furthermore, the
COPYING file was missing from sdist, even though it was referenced in README.

- Small cleanups to cache cleanup interval
([#1146](https://github.com/python-zeroconf/python-zeroconf/pull/1146),
[`b434b60`](https://github.com/python-zeroconf/python-zeroconf/commit/b434b60f14ebe8f114b7b19bb4f54081c8ae0173))
Expand Down
8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ license = "LGPL-2.1-or-later"
description = "A pure python implementation of multicast DNS service discovery"
readme = "README.rst"
authors = [
{ name = "Paul Scott-Murphy" },
{ name = "William McBrine" },
{ name = "Jakub Stasiak" },
{ name = "J. Nick Koston" },
{ name = "The python-zeroconf authors" }, # full history in COPYING and git
]
maintainers = [
{ name = "J. Nick Koston", email = "[email protected]" },
]
requires-python = ">=3.10"

Expand Down
2 changes: 1 addition & 1 deletion src/zeroconf/_dns.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def _fast_init(self, name: str, type_: _int, class_: _int) -> None:


class DNSRecord(DNSEntry): # noqa: PLW1641
"""A DNS entry that also carries a TTL and creation time."""
"""Record layered on the entry identity with a TTL and creation time."""

__slots__ = ("created", "ttl")

Expand Down
2 changes: 1 addition & 1 deletion src/zeroconf/_utils/name.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def service_type_name(type_: str, *, strict: bool = True) -> str: # pylint: dis
and anything else that may be represented using Net-Unicode.

:param type_: Type, SubType or service name to validate
:return: fully qualified service name (eg: _http._tcp.local.)
:return: the validated name, fully qualified (eg: _http._tcp.local.)
"""
if len(type_) > 256:
# https://datatracker.ietf.org/doc/html/rfc6763#section-7.2
Expand Down
24 changes: 12 additions & 12 deletions tests/test_asyncio.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ async def test_async_service_registration(quick_timing: None) -> None:

calls = []

class MyListener(ServiceListener):
class EventStore(ServiceListener):
def add_service(self, zeroconf: Zeroconf, type: str, name: str) -> None:
calls.append(("add", type, name))

Expand All @@ -148,7 +148,7 @@ def remove_service(self, zeroconf: Zeroconf, type: str, name: str) -> None:
def update_service(self, zeroconf: Zeroconf, type: str, name: str) -> None:
calls.append(("update", type, name))

listener = MyListener()
listener = EventStore()

aiozc.zeroconf.add_service_listener(type_, listener)

Expand Down Expand Up @@ -193,7 +193,7 @@ async def test_async_service_registration_with_server_missing(quick_timing: None

calls = []

class MyListener(ServiceListener):
class EventStore(ServiceListener):
def add_service(self, zeroconf: Zeroconf, type: str, name: str) -> None:
calls.append(("add", type, name))

Expand All @@ -203,7 +203,7 @@ def remove_service(self, zeroconf: Zeroconf, type: str, name: str) -> None:
def update_service(self, zeroconf: Zeroconf, type: str, name: str) -> None:
calls.append(("update", type, name))

listener = MyListener()
listener = EventStore()

aiozc.zeroconf.add_service_listener(type_, listener)

Expand Down Expand Up @@ -252,7 +252,7 @@ async def test_async_service_registration_same_server_different_ports(quick_timi

calls = []

class MyListener(ServiceListener):
class EventStore(ServiceListener):
def add_service(self, zeroconf: Zeroconf, type: str, name: str) -> None:
calls.append(("add", type, name))

Expand All @@ -262,7 +262,7 @@ def remove_service(self, zeroconf: Zeroconf, type: str, name: str) -> None:
def update_service(self, zeroconf: Zeroconf, type: str, name: str) -> None:
calls.append(("update", type, name))

listener = MyListener()
listener = EventStore()

aiozc.zeroconf.add_service_listener(type_, listener)

Expand Down Expand Up @@ -310,7 +310,7 @@ async def test_async_service_registration_same_server_same_ports(quick_timing: N

calls = []

class MyListener(ServiceListener):
class EventStore(ServiceListener):
def add_service(self, zeroconf: Zeroconf, type: str, name: str) -> None:
calls.append(("add", type, name))

Expand All @@ -320,7 +320,7 @@ def remove_service(self, zeroconf: Zeroconf, type: str, name: str) -> None:
def update_service(self, zeroconf: Zeroconf, type: str, name: str) -> None:
calls.append(("update", type, name))

listener = MyListener()
listener = EventStore()

aiozc.zeroconf.add_service_listener(type_, listener)

Expand Down Expand Up @@ -432,7 +432,7 @@ async def test_async_tasks(quick_timing: None) -> None:

calls = []

class MyListener(ServiceListener):
class EventStore(ServiceListener):
def add_service(self, zeroconf: Zeroconf, type: str, name: str) -> None:
calls.append(("add", type, name))

Expand All @@ -442,7 +442,7 @@ def remove_service(self, zeroconf: Zeroconf, type: str, name: str) -> None:
def update_service(self, zeroconf: Zeroconf, type: str, name: str) -> None:
calls.append(("update", type, name))

listener = MyListener()
listener = EventStore()
aiozc.zeroconf.add_service_listener(type_, listener)

desc = {"path": "/healthz/"}
Expand Down Expand Up @@ -609,7 +609,7 @@ async def test_async_service_browser(quick_timing: None) -> None:

calls = []

class MyListener(ServiceListener):
class EventStore(ServiceListener):
def add_service(self, aiozc: Zeroconf, type: str, name: str) -> None:
calls.append(("add", type, name))

Expand All @@ -619,7 +619,7 @@ def remove_service(self, aiozc: Zeroconf, type: str, name: str) -> None:
def update_service(self, aiozc: Zeroconf, type: str, name: str) -> None:
calls.append(("update", type, name))

listener = MyListener()
listener = EventStore()
await aiozc.async_add_service_listener(type_, listener)

desc = {"path": "/healthz/"}
Expand Down
8 changes: 4 additions & 4 deletions tests/test_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1208,7 +1208,7 @@ async def test_record_update_manager_add_listener_callsback_existing_records():
zc: Zeroconf = aiozc.zeroconf
updated = []

class MyListener(r.RecordUpdateListener):
class EventStore(r.RecordUpdateListener):
"""A RecordUpdateListener that does not implement update_records."""

def async_update_records(self, zc: Zeroconf, now: float, records: list[r.RecordUpdate]) -> None:
Expand All @@ -1225,7 +1225,7 @@ def async_update_records(self, zc: Zeroconf, now: float, records: list[r.RecordU
ptr_record = info.dns_pointer()
zc.cache.async_add_records([ptr_record, a_record, info.dns_text(), info.dns_service()])

listener = MyListener()
listener = EventStore()

zc.add_listener(
listener,
Expand Down Expand Up @@ -1750,14 +1750,14 @@ async def test_add_listener_warns_when_not_using_record_update_listener(caplog):
zc: Zeroconf = aiozc.zeroconf
updated = []

class MyListener:
class EventStore:
"""A RecordUpdateListener that does not implement update_records."""

def async_update_records(self, zc: Zeroconf, now: float, records: list[r.RecordUpdate]) -> None:
"""Update multiple records in one shot."""
updated.extend(records)

zc.add_listener(MyListener(), None) # type: ignore[arg-type]
zc.add_listener(EventStore(), None) # type: ignore[arg-type]
await asyncio.sleep(0) # flush out any call soons
assert (
"listeners passed to async_add_listener must inherit from RecordUpdateListener" in caplog.text
Expand Down
4 changes: 2 additions & 2 deletions tests/test_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def test_integration_with_listener_class(self):
name = "UPPERxxxyyyæøå"
registration_name = f"{name}.{subtype}"

class MyListener(r.ServiceListener):
class EventStore(r.ServiceListener):
def add_service(self, zeroconf, type, name):
zeroconf.get_service_info(type, name)
service_added.set()
Expand Down Expand Up @@ -78,7 +78,7 @@ def remove_service(self, zeroconf, type, name):
def update_service(self, zeroconf, type, name):
sub_service_updated.set()

listener = MyListener()
listener = EventStore()
zeroconf_browser = Zeroconf(interfaces=["127.0.0.1"])
zeroconf_browser.add_service_listener(type_, listener)

Expand Down
Loading