@@ -35,10 +35,7 @@ def test_integration_with_listener(self):
3535 "ash-2.local." ,
3636 addresses = [socket .inet_aton ("10.0.1.2" )],
3737 )
38- zeroconf_registrar .register_service (info )
39- # Ensure we do not clear the cache until after the last broadcast is processed
40- time .sleep (0.2 )
41- _clear_cache (zeroconf_registrar )
38+ zeroconf_registrar .registry .add (info )
4239 try :
4340 service_types = ZeroconfServiceTypes .find (interfaces = ['127.0.0.1' ], timeout = 0.5 )
4441 assert type_ in service_types
@@ -70,10 +67,7 @@ def test_integration_with_listener_v6_records(self):
7067 "ash-2.local." ,
7168 addresses = [socket .inet_pton (socket .AF_INET6 , addr )],
7269 )
73- zeroconf_registrar .register_service (info )
74- # Ensure we do not clear the cache until after the last broadcast is processed
75- time .sleep (0.2 )
76- _clear_cache (zeroconf_registrar )
70+ zeroconf_registrar .registry .add (info )
7771 try :
7872 service_types = ZeroconfServiceTypes .find (interfaces = ['127.0.0.1' ], timeout = 0.5 )
7973 assert type_ in service_types
@@ -104,10 +98,7 @@ def test_integration_with_listener_ipv6(self):
10498 "ash-2.local." ,
10599 addresses = [socket .inet_aton ("10.0.1.2" )],
106100 )
107- zeroconf_registrar .register_service (info )
108- # Ensure we do not clear the cache until after the last broadcast is processed
109- time .sleep (0.2 )
110- _clear_cache (zeroconf_registrar )
101+ zeroconf_registrar .registry .add (info )
111102 try :
112103 service_types = ZeroconfServiceTypes .find (ip_version = r .IPVersion .V6Only , timeout = 0.5 )
113104 assert type_ in service_types
@@ -138,10 +129,7 @@ def test_integration_with_subtype_and_listener(self):
138129 "ash-2.local." ,
139130 addresses = [socket .inet_aton ("10.0.1.2" )],
140131 )
141- zeroconf_registrar .register_service (info )
142- # Ensure we do not clear the cache until after the last broadcast is processed
143- time .sleep (0.2 )
144- _clear_cache (zeroconf_registrar )
132+ zeroconf_registrar .registry .add (info )
145133 try :
146134 service_types = ZeroconfServiceTypes .find (interfaces = ['127.0.0.1' ], timeout = 0.5 )
147135 assert discovery_type in service_types
0 commit comments