diff --git a/platypush/plugins/zeroconf.py b/platypush/plugins/zeroconf.py index c136a453..cdbc30e4 100644 --- a/platypush/plugins/zeroconf.py +++ b/platypush/plugins/zeroconf.py @@ -25,7 +25,7 @@ class ZeroconfListener(zeroconf.ServiceListener): @staticmethod def parse_service_info(info: ServiceInfo) -> dict: return { - 'addresses': [socket.inet_ntoa(addr) for addr in info.addresses], + 'addresses': [socket.inet_ntoa(addr) for addr in info.addresses if info and info.addresses], 'port': info.port, 'host_ttl': info.host_ttl, 'other_ttl': info.other_ttl, diff --git a/tests/test_event_parse.py b/tests/test_event_parse.py index 12ce5c9e..4291ddf4 100644 --- a/tests/test_event_parse.py +++ b/tests/test_event_parse.py @@ -9,12 +9,10 @@ from . import BaseTest, conf_dir class TestEventParse(BaseTest): config_file = os.path.join(conf_dir, 'test_http_config.yaml') - - def setUp(self): - self.condition = EventCondition.build({ - 'type': 'platypush.message.event.ping.PingEvent', - 'message': 'This is (the)? answer: ${answer}' - }) + condition = EventCondition.build({ + 'type': 'platypush.message.event.ping.PingEvent', + 'message': 'This is (the)? answer: ${answer}' + }) def test_event_parse(self): message = "GARBAGE GARBAGE this is the answer: 42"