fix(tests): Move mock_driver fixture to module level for shared access
Fixes integration test failures where TestRealWorldScenario tests couldn't access the mock_driver fixture. The mock_driver fixture was defined inside TestPeripheralDisconnectCleanup class, making it unavailable to TestRealWorldScenario class. This caused pytest fixture lookup errors: - test_both_monitoring_mechanisms_detect_disconnect_idempotent - test_polling_catches_missed_dbus_signal Solution: Move mock_driver to module level (outside class) so all test classes can access it as a shared fixture. All integration tests now pass locally. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
b336b73396
commit
adb5544bff
1 changed files with 17 additions and 15 deletions
|
|
@ -45,24 +45,26 @@ if not hasattr(RNS, 'LOG_INFO'):
|
|||
RNS.log = Mock()
|
||||
|
||||
|
||||
# Module-level fixture (shared across test classes)
|
||||
@pytest.fixture
|
||||
def mock_driver():
|
||||
"""Create a mock Linux BLE driver with GATT server capabilities."""
|
||||
driver = Mock()
|
||||
driver.loop = asyncio.new_event_loop()
|
||||
driver._peers = {} # address -> peer_conn
|
||||
driver._peers_lock = asyncio.Lock()
|
||||
driver._log = Mock()
|
||||
driver.on_device_disconnected = Mock()
|
||||
|
||||
# Mock method that should be added
|
||||
driver._handle_peripheral_disconnected = Mock()
|
||||
|
||||
return driver
|
||||
|
||||
|
||||
class TestPeripheralDisconnectCleanup:
|
||||
"""Test peripheral disconnection cleanup mechanisms."""
|
||||
|
||||
@pytest.fixture
|
||||
def mock_driver(self):
|
||||
"""Create a mock Linux BLE driver with GATT server capabilities."""
|
||||
driver = Mock()
|
||||
driver.loop = asyncio.new_event_loop()
|
||||
driver._peers = {} # address -> peer_conn
|
||||
driver._peers_lock = asyncio.Lock()
|
||||
driver._log = Mock()
|
||||
driver.on_device_disconnected = Mock()
|
||||
|
||||
# Mock method that should be added
|
||||
driver._handle_peripheral_disconnected = Mock()
|
||||
|
||||
return driver
|
||||
|
||||
@pytest.fixture
|
||||
def mock_gatt_server(self, mock_driver):
|
||||
"""Create a mock GATT server with connected centrals."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue