test: Set up comprehensive Python testing infrastructure with Poetry #112
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add Python Testing Infrastructure
Summary
This PR sets up a comprehensive testing infrastructure for the Sniffle Python CLI using Poetry as the package manager and pytest as the testing framework.
Changes Made
Package Management
python_cli/pyproject.tomlpyserial(required)numpy,scipypytest,pytest-cov,pytest-mockTesting Configuration
Pytest configuration with:
unit,integration,slowCoverage settings:
snifflepackageDirectory Structure
Testing Fixtures
Created comprehensive fixtures in
conftest.py:temp_dir- Temporary directory managementmock_serial_port- Serial port mockingmock_pcap_writer- PCAP writer mockingsample_ble_packet- BLE packet test datasample_adv_packet- BLE advertising packet datamock_decoder- Packet decoder mockingmock_ble_config- BLE configurationtest_firmware_file- Firmware file testingmock_sniffle_hw- Hardware interface mockingcapture_output- stdout/stderr capturemock_time- Time function mockingDevelopment Commands
Added Poetry scripts for convenience:
poetry run test- Run all testspoetry run tests- Alternative command (both work)Additional Setup
.gitignorewith Python/testing artifacts and Claude settingsUsage Instructions
Initial Setup
Running Tests
Writing Tests
tests/unit/tests/integration/conftest.pyfor common test needs@pytest.mark.unit,@pytest.mark.integration,@pytest.mark.slowNotes
pyproject.tomlsince no actual tests exist yetValidation
The infrastructure has been validated with a comprehensive test suite that verifies:
EOF < /dev/null