feat: Add comprehensive Python testing infrastructure with Poetry #74
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 complete testing infrastructure for the VAmPI project using Poetry for dependency management and pytest as the testing framework. The setup provides a foundation for writing unit and integration tests with proper coverage reporting.
Changes Made
Package Management
requirements.txt
to Poetry (pyproject.toml
)package-mode = false
for non-distributable projectspoetry.lock
file to ensure reproducible buildsTesting Dependencies
Added the following development dependencies:
Testing Configuration
Configured comprehensive testing settings in
pyproject.toml
:unit
,integration
, andslow
for test categorizationDirectory Structure
Shared Fixtures
Created reusable fixtures in
conftest.py
:temp_dir
- Temporary directory for test filesmock_config
- Mock Flask configurationsample_user_data
- Test user datasample_book_data
- Test book datacapture_logs
- Log capturing utilityAdditional Updates
.gitignore
to exclude testing artifacts and Claude settingsCLAUDE.md
with testing commands documentationRunning Tests
Basic Commands
Coverage Commands
Notes
Circular Import Issue: The application has circular imports between
app.py
,config.py
, and model files. Tests that import the app will fail until this is resolved. The infrastructure validation tests work without importing the app.Poetry Scripts: The
poetry run test
andpoetry run tests
commands are configured but show warnings due to the package-mode setting. Usepoetry run pytest
directly for now.Coverage Threshold: The 80% coverage requirement is configured but will fail until actual unit tests are written for the application code.
Next Steps