feat: Set up Python testing infrastructure with Poetry#150
Open
llbbl wants to merge 1 commit intoEFForg:masterfrom
Open
feat: Set up Python testing infrastructure with Poetry#150llbbl wants to merge 1 commit intoEFForg:masterfrom
llbbl wants to merge 1 commit intoEFForg:masterfrom
Conversation
- Replace Pipfile with Poetry configuration in pyproject.toml - Add pytest, pytest-cov, and pytest-mock as dev dependencies - Configure comprehensive pytest and coverage settings - Create testing directory structure with unit/integration separation - Add shared pytest fixtures in conftest.py - Set up Poetry script commands for running tests - Update .gitignore with testing and Claude entries - Create 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 CrocodileHunter project using Poetry as the package manager and pytest as the testing framework. The setup provides a solid foundation for developers to write and run tests with proper coverage reporting and organization.
Changes Made
Package Management
Testing Framework
pytest(^7.4.0) - Main testing frameworkpytest-cov(^4.1.0) - Coverage reportingpytest-mock(^3.11.1) - Mocking utilitiesTesting Configuration
Pytest configuration in pyproject.toml:
test_*.pyand*_test.py@pytest.mark.unit,@pytest.mark.integration,@pytest.mark.slowCoverage configuration:
src/directoryhtmlcov/coverage.xmlDirectory Structure
Test Fixtures (conftest.py)
Created comprehensive fixtures for testing:
temp_dir: Temporary directory for test filesmock_config: Mock configuration dictionarymock_database_session: Mock database session for testingflask_test_client: Placeholder for Flask test clientsample_tower_data: Sample tower data for testingsample_gps_data: Sample GPS data for testingreset_environment: Reset environment variables between testsmock_requests: Mock requests library for API testingisolated_filesystem: Create isolated filesystem for file operationsPoetry Scripts
poetry run test- Run all testspoetry run tests- Alternative command (both work)How to Use
Install Dependencies
Run Tests
Coverage Reports
After running tests, coverage reports are available in:
htmlcov/index.html- HTML coverage reportcoverage.xml- XML report for CI/CD integrationValidation
The setup has been validated with:
Notes
Existing .gitignore: The project already has comprehensive gitignore entries for Python development, including test artifacts.
Poetry Lock File: The
poetry.lockfile has been generated and should be committed to ensure reproducible builds.Virtual Environment: Poetry creates a virtual environment in
.venv/which is properly ignored by git.Coverage Threshold: Set to 80% as requested. The validation tests alone won't meet this threshold - actual unit tests for the codebase are needed.
Next Steps
src/The testing infrastructure is now ready for developers to start writing comprehensive tests for the CrocodileHunter project