Skip to content

Commit eb8281e

Browse files
committed
fix CI test
1 parent 26079ba commit eb8281e

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

docs/self-hosting.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ You can configure the add-on via the **Configuration** tab:
4444

4545
#### 🧩 Automatic Integration Management & Synchronization
4646
When this add-on starts, it automatically manages the **DB Infoscreen Integration** for you:
47+
4748
1. **Detection**: It checks if the `db_infoscreen` custom component is installed in your `/config/custom_components/` directory.
4849
2. **Auto-Install/Update**: If the integration is missing or a newer release exists on GitHub, the add-on will automatically download and install/update the custom component files.
4950
3. **Notification**: If the integration was updated or installed, a persistent notification will appear on your Home Assistant dashboard, prompting you to restart Home Assistant.

tests/test_live_api.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,21 @@
1919
# Make sure pytest-socket knows we need sockets for these tests
2020
pytestmark = [pytest.mark.allow_sockets, pytest.mark.enable_socket]
2121

22+
original_allowed_hosts = None
23+
original_allowed_hosts_saved = False
24+
2225

2326
def _enable_socket_temporarily():
2427
"""Bypass pytest-socket blocking during these tests."""
28+
global original_allowed_hosts, original_allowed_hosts_saved
2529
try:
2630
import pytest_socket
2731

2832
pytest_socket.enable_socket()
33+
if not original_allowed_hosts_saved and hasattr(pytest_socket, "_allowed_hosts"):
34+
original_allowed_hosts = pytest_socket._allowed_hosts
35+
original_allowed_hosts_saved = True
36+
pytest_socket.socket_allow_hosts(None)
2937
except (ImportError, AttributeError):
3038
pass
3139
try:
@@ -37,11 +45,24 @@ def _enable_socket_temporarily():
3745
pass
3846

3947

48+
def _restore_socket_state():
49+
"""Restore pytest-socket allow list to original state."""
50+
global original_allowed_hosts, original_allowed_hosts_saved
51+
if original_allowed_hosts_saved:
52+
try:
53+
import pytest_socket
54+
55+
pytest_socket.socket_allow_hosts(original_allowed_hosts)
56+
except (ImportError, AttributeError):
57+
pass
58+
59+
4060
@pytest.fixture(autouse=True)
4161
def auto_enable_socket():
4262
"""Automatically enable socket for every test in this module."""
4363
_enable_socket_temporarily()
4464
yield
65+
_restore_socket_state()
4566

4667

4768
async def check_server_status() -> tuple[bool, str]:

0 commit comments

Comments
 (0)