diff --git a/install.sh b/install.sh index 3cf429c..f923d11 100755 --- a/install.sh +++ b/install.sh @@ -35,6 +35,19 @@ print_info() { echo -e "${BLUE}ℹ${NC} $1" } +# Helper function: Detect if running in a container environment +is_container() { + # Check for Docker container + if [ -f /.dockerenv ]; then + return 0 + fi + # Check cgroup for container indicators + if grep -q -E 'docker|lxc|containerd|kubepods' /proc/1/cgroup 2>/dev/null; then + return 0 + fi + return 1 +} + # Helper function: pip install with compatibility across all OS versions pip_install() { local packages="$*" @@ -680,7 +693,13 @@ fi # Step 5B: Bluetooth Adapter Power State print_header "Bluetooth Adapter Power State" -if command -v bluetoothctl &> /dev/null; then +# Skip Bluetooth checks in container environments (no hardware access) +if is_container; then + print_info "Container environment detected - skipping Bluetooth adapter checks" + print_warning "Bluetooth hardware is not available in containers" + print_info "This is expected behavior for CI/testing environments" + echo +elif command -v bluetoothctl &> /dev/null; then print_info "Checking Bluetooth adapter power state..." # Check for rfkill blocks first (must be unblocked before power-on works) diff --git a/tests/test_peripheral_disconnect_cleanup.py b/tests/test_peripheral_disconnect_cleanup.py index ab08a8e..5ee9212 100644 --- a/tests/test_peripheral_disconnect_cleanup.py +++ b/tests/test_peripheral_disconnect_cleanup.py @@ -23,6 +23,7 @@ import sys import os import asyncio import time +import threading from unittest.mock import Mock, MagicMock, AsyncMock, patch, call # Add src to path diff --git a/tests/test_stale_connection_polling.py b/tests/test_stale_connection_polling.py index ae2c488..d296edd 100644 --- a/tests/test_stale_connection_polling.py +++ b/tests/test_stale_connection_polling.py @@ -89,8 +89,8 @@ class TestStaleConnectionPolling: start_time = time.time() thread.start() - # Let it run for ~2 checks - time.sleep(0.15) + # Let it run for ~2 checks (need >1.2s for 2 complete cycles at 0.6s each) + time.sleep(1.5) stop_event.set() thread.join(timeout=1.0)