File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1111
1212from custom_components .sunspec .api import ConnectionError
1313from custom_components .sunspec .api import ConnectionTimeoutError
14+ from custom_components .sunspec .api import SunSpecApiClient
1415
1516pytest_plugins = "pytest_homeassistant_custom_component"
1617_LOGGER : logging .Logger = logging .getLogger (__package__ )
@@ -58,6 +59,14 @@ def auto_enable_custom_integrations(
5859 """Enable custom integrations defined in the test dir."""
5960
6061
62+ @pytest .fixture (autouse = True )
63+ def clear_sunspec_client_cache ():
64+ """Avoid cross-test reuse of cached clients with different fixture behavior."""
65+ SunSpecApiClient .CLIENT_CACHE = {}
66+ yield
67+ SunSpecApiClient .CLIENT_CACHE = {}
68+
69+
6170# This fixture, when used, will result in calls to async_get_data to return None. To have the call
6271# return a value, we would add the `return_value=<VALUE_TO_RETURN>` parameter to the patch call.
6372@pytest .fixture (name = "bypass_get_device_info" )
You can’t perform that action at this time.
0 commit comments