feat: Set up comprehensive Python testing infrastructure with Poetry#88
Open
llbbl wants to merge 1 commit into
Open
feat: Set up comprehensive Python testing infrastructure with Poetry#88llbbl wants to merge 1 commit into
llbbl wants to merge 1 commit into
Conversation
- Initialize Poetry package manager with pyproject.toml - Add pytest, pytest-cov, and pytest-mock as dev dependencies - Configure pytest with coverage reporting and custom markers - Create tests directory structure with shared fixtures - Add Poetry script commands for running tests - Update .gitignore with testing and development entries - Add validation tests to verify infrastructure setup
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.
Set Up Python Testing Infrastructure
Summary
This PR establishes a comprehensive testing infrastructure for the vehicle detection project using Poetry as the package manager and pytest as the testing framework. The setup provides a ready-to-use environment for developers to immediately start writing tests.
Changes Made
Package Management
pyproject.tomlwith Poetry configurationrequirements.txtto PoetryTesting Configuration
pytest Configuration:
test_*.pyand*_test.pyfilesCoverage Configuration:
utilsandprotosDirectory Structure
Shared Fixtures (conftest.py)
temp_dir: Temporary directory for test filesmock_config: Mock configuration dictionarysample_image_path,sample_video_path: Sample file pathsmock_label_map: Object detection label mappingsample_detection_result: Sample detection resultsmock_model_config: Model configuration filecolor_training_data: Color recognition training datareset_environment: Environment reset fixturecapture_logs: Log capture utilityDevelopment Commands
poetry run test- Run all testspoetry run tests- Alternative command (both work identically)Additional Setup
.gitignorewith:poetry.lockis NOT ignored and should be committedHow to Use
Install dependencies:
Run all tests:
Run specific test categories:
View coverage report:
Validation
The infrastructure has been validated with a test suite that verifies:
Next Steps
pyproject.tomlas tests are addedNotes