Fix socket usage in Aprs test (#60253)

This commit is contained in:
Simone Chemelli
2021-11-24 03:02:03 +01:00
committed by GitHub
parent 4555f52e50
commit e1de6612be

View File

@@ -327,19 +327,18 @@ def test_setup_scanner():
def test_setup_scanner_timeout():
"""Test setup_scanner failure from timeout."""
hass = get_test_home_assistant()
hass.start()
with patch("aprslib.IS.connect", side_effect=TimeoutError):
hass = get_test_home_assistant()
hass.start()
config = {
"username": TEST_CALLSIGN,
"password": TEST_PASSWORD,
"host": "localhost",
"timeout": 0.01,
"callsigns": ["XX0FOO*", "YY0BAR-1"],
}
config = {
"username": TEST_CALLSIGN,
"password": TEST_PASSWORD,
"host": "localhost",
"timeout": 0.01,
"callsigns": ["XX0FOO*", "YY0BAR-1"],
}
see = Mock()
try:
see = Mock()
assert not device_tracker.setup_scanner(hass, config, see)
finally:
hass.stop()