mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 12:59:34 +00:00
Add bluetooth integration (#74653)
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
This commit is contained in:
25
tests/components/bluetooth/conftest.py
Normal file
25
tests/components/bluetooth/conftest.py
Normal file
@@ -0,0 +1,25 @@
|
||||
"""Tests for the bluetooth component."""
|
||||
|
||||
import threading
|
||||
|
||||
import pytest
|
||||
|
||||
from tests.common import INSTANCES
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def verify_cleanup():
|
||||
"""Verify that the test has cleaned up resources correctly."""
|
||||
threads_before = frozenset(threading.enumerate())
|
||||
|
||||
yield
|
||||
|
||||
if len(INSTANCES) >= 2:
|
||||
count = len(INSTANCES)
|
||||
for inst in INSTANCES:
|
||||
inst.stop()
|
||||
pytest.exit(f"Detected non stopped instances ({count}), aborting test run")
|
||||
|
||||
threads = frozenset(threading.enumerate()) - threads_before
|
||||
for thread in threads:
|
||||
assert isinstance(thread, threading._DummyThread)
|
||||
Reference in New Issue
Block a user