mirror of
https://github.com/home-assistant/core.git
synced 2025-07-27 23:27:37 +00:00
Turn off autospec for zeroconf mocks (#143879)
This commit is contained in:
parent
c771f446b4
commit
9c3b0952e0
@ -1345,12 +1345,13 @@ def mock_zeroconf() -> Generator[MagicMock]:
|
|||||||
from zeroconf import DNSCache # pylint: disable=import-outside-toplevel
|
from zeroconf import DNSCache # pylint: disable=import-outside-toplevel
|
||||||
|
|
||||||
with (
|
with (
|
||||||
patch("homeassistant.components.zeroconf.HaZeroconf", autospec=True) as mock_zc,
|
patch("homeassistant.components.zeroconf.HaZeroconf") as mock_zc,
|
||||||
patch(
|
patch(
|
||||||
"homeassistant.components.zeroconf.discovery.AsyncServiceBrowser",
|
"homeassistant.components.zeroconf.discovery.AsyncServiceBrowser",
|
||||||
autospec=True,
|
) as mock_browser,
|
||||||
),
|
|
||||||
):
|
):
|
||||||
|
asb = mock_browser.return_value
|
||||||
|
asb.async_cancel = AsyncMock()
|
||||||
zc = mock_zc.return_value
|
zc = mock_zc.return_value
|
||||||
# DNSCache has strong Cython type checks, and MagicMock does not work
|
# DNSCache has strong Cython type checks, and MagicMock does not work
|
||||||
# so we must mock the class directly
|
# so we must mock the class directly
|
||||||
|
Loading…
x
Reference in New Issue
Block a user