Skip to content

Commit 1eaeef2

Browse files
authored
Fix flakey test_update_record (#470)
1 parent 8a9ae29 commit 1eaeef2

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

zeroconf/test.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1980,9 +1980,6 @@ def mock_incoming_msg(
19801980
zeroconf.handle_response(
19811981
mock_incoming_msg(r.ServiceStateChange.Added, service_types[1], service_names[1], 120)
19821982
)
1983-
zeroconf.handle_response(
1984-
mock_incoming_msg(r.ServiceStateChange.Added, service_types[2], service_names[2], 120)
1985-
)
19861983

19871984
called_with_refresh_time_check = False
19881985

@@ -1995,6 +1992,12 @@ def _mock_get_expiration_time(self, percent):
19951992

19961993
# Set an expire time that will force a refresh
19971994
with unittest.mock.patch("zeroconf.DNSRecord.get_expiration_time", new=_mock_get_expiration_time):
1995+
zeroconf.handle_response(
1996+
mock_incoming_msg(r.ServiceStateChange.Added, service_types[0], service_names[0], 120)
1997+
)
1998+
# Add the last record after updating the first one
1999+
# to ensure the service_add_event only gets set
2000+
# after the update
19982001
zeroconf.handle_response(
19992002
mock_incoming_msg(r.ServiceStateChange.Added, service_types[2], service_names[2], 120)
20002003
)

0 commit comments

Comments
 (0)