Skip to content
Merged
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
13 changes: 13 additions & 0 deletions zeroconf/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,15 @@
original_logging_level = logging.NOTSET


@pytest.fixture(autouse=True)
def verify_threads_ended():
"""Verify that the threads are not running after the test."""
threads_before = frozenset(threading.enumerate())
yield
threads = frozenset(threading.enumerate()) - threads_before
assert not threads


def setup_module():
global original_logging_level
original_logging_level = log.level
Expand Down Expand Up @@ -924,6 +933,7 @@ def send(out, addr=r._MDNS_ADDR, port=r._MDNS_PORT):
zc.unregister_service(info)
assert nbr_answers == 12 and nbr_additionals == 0 and nbr_authorities == 0
nbr_answers = nbr_additionals = nbr_authorities = 0
zc.close()

def test_name_conflicts(self):
# instantiate a zeroconf instance
Expand Down Expand Up @@ -952,6 +962,7 @@ def test_name_conflicts(self):
)
with pytest.raises(r.NonUniqueNameException):
zc.register_service(conflicting_info)
zc.close()


class TestServiceRegistry(unittest.TestCase):
Expand Down Expand Up @@ -1598,6 +1609,7 @@ def test_service_info_rejects_non_matching_updates(self):
),
)
assert new_address not in info.addresses
zc.close()

def test_get_info_partial(self):

Expand Down Expand Up @@ -2188,6 +2200,7 @@ def send(out, addr=r._MDNS_ADDR, port=r._MDNS_PORT):

# unregister
zc.unregister_service(info)
zc.close()


def test_dns_compression_rollback_for_corruption():
Expand Down