test: Set up comprehensive Python testing infrastructure with Poetry#112
Open
llbbl wants to merge 1 commit intonccgroup:masterfrom
Open
test: Set up comprehensive Python testing infrastructure with Poetry#112llbbl wants to merge 1 commit intonccgroup:masterfrom
llbbl wants to merge 1 commit intonccgroup:masterfrom
Conversation
- Add Poetry configuration with pyproject.toml - Configure pytest with coverage reporting and custom markers - Create test directory structure (unit/integration) - Add comprehensive pytest fixtures in conftest.py - Set up Poetry scripts for running tests - Update .gitignore with testing and Python artifacts - Add validation tests to verify infrastructure EOF < /dev/null
Collaborator
|
Thanks, this will be helpful for future development. I will review in more detail and test when I have some time. |
Author
|
Thanks for the positive feedback! I'm happy this looks helpful for your project. Sounds good regarding the review. I'll be here if you need anything. |
|
Nice work on this Logan! Looks super useful @llbbl |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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