meshcore_py/tests
Matthew Wolter 75c4a58841 Fix test fixture to resolve events immediately instead of blocking
The mock_dispatcher fixture's fake_subscribe recorded event handlers
but never called them, causing asyncio.wait() to block for the full
DEFAULT_TIMEOUT (15s) on every test that passes expected_events to
send(). With 28 affected tests, the suite wasted ~8 minutes on dead
waits and required an undocumented pytest-timeout plugin to complete.

Add call_soon to the default fake_subscribe so futures resolve on the
next event loop iteration, matching the pattern already used by
setup_event_response(). Override with a non-resolving mock in
test_send_timeout to preserve timeout path coverage.

Suite now completes in <1 second with no --timeout flag.
2026-04-12 06:57:53 -07:00
..
unit Fix test fixture to resolve events immediately instead of blocking 2026-04-12 06:57:53 -07:00
README.md Added in some unit tests 2025-04-13 22:55:39 -07:00
test_ble_connection.py Implement BLE PIN pairing support for enhanced security 2025-09-24 00:21:30 +02:00
test_ble_pin_pairing.py Implement BLE PIN pairing support for enhanced security 2025-09-24 00:21:30 +02:00
test_meshcore_ble_pin.py Implement BLE PIN pairing support for enhanced security 2025-09-24 00:21:30 +02:00

MeshCore Tests

Running Tests

To run the tests, first install the development dependencies:

pip install -e ".[dev]"

Then run the tests using pytest:

# Run all tests
pytest

# Run tests with verbose output
pytest -v

# Run a specific test file
pytest tests/unit/test_commands.py

# Run a specific test
pytest tests/unit/test_commands.py::test_send_msg