Skip to content
Snippets Groups Projects
Unverified Commit 6840f27b authored by Erik Montnemery's avatar Erik Montnemery Committed by GitHub
Browse files

Verify respx mock routes are cleaned up when tests finish (#122852)

parent 4a34855a
No related branches found
No related tags found
No related merge requests found
......@@ -34,6 +34,7 @@ import multidict
import pytest
import pytest_socket
import requests_mock
import respx
from syrupy.assertion import SnapshotAssertion
from homeassistant import block_async_io
......@@ -398,6 +399,13 @@ def verify_cleanup(
# Restore the default time zone to not break subsequent tests
dt_util.DEFAULT_TIME_ZONE = datetime.UTC
try:
# Verify respx.mock has been cleaned up
assert not respx.mock.routes, "respx.mock routes not cleaned up, maybe the test needs to be decorated with @respx.mock"
finally:
# Clear mock routes not break subsequent tests
respx.mock.clear()
@pytest.fixture(autouse=True)
def reset_hass_threading_local_object() -> Generator[None]:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment