Conversation
- Add Poetry package manager with pyproject.toml configuration - Migrate dependencies from requirements.txt to Poetry format - Add pytest, pytest-cov, pytest-mock, and pytest-asyncio as test dependencies - Configure pytest with custom markers (unit, integration, slow) - Set up coverage reporting with 80% threshold, HTML and XML output - Create tests/ directory structure with unit/ and integration/ subdirectories - Add comprehensive conftest.py with shared fixtures for testing - Update .gitignore with testing-related entries and Claude configuration - Create validation test suite to verify infrastructure functionality - All tests passing with proper coverage reporting and marker filtering
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 QR Redactor Python project, migrating from a simple requirements.txt setup to a modern Poetry-based development environment with full testing capabilities.
Changes Made
Package Management
pyproject.tomlwith Poetry configurationrequirements.txtto Poetry formatTesting Configuration
✅ Pytest Configuration: Comprehensive pytest settings in
pyproject.tomlunit,integration,slow✅ Coverage Configuration: Detailed coverage settings
Directory Structure
Shared Test Fixtures
The
conftest.pyfile provides comprehensive fixtures including:temp_dirandtemp_filefor file system testingsample_textandsample_sensitive_datafor application-specific testingtest_clientfor FastAPI endpoint testingtest_dbfor isolated database testingmock_*fixtures for various mocking scenariosDevelopment Workflow
✅ Testing Commands:
poetry run pytest- Run all testspoetry run pytest -m unit- Run only unit testspoetry run pytest -m integration- Run only integration testspoetry run pytest -m "not slow"- Skip slow tests✅ Coverage Reporting:
htmlcov/directoryProject Configuration
Validation
The infrastructure has been validated with a comprehensive test suite (
test_infrastructure.py) that verifies:Testing Instructions
Install Dependencies
cd qr-redactor poetry installRun All Tests
Run Tests with Coverage
Run Specific Test Types
View Coverage Report
After running tests with coverage, open
htmlcov/index.htmlin your browser.Notes
poetry.lockfile is intentionally tracked in git for reproducible buildsReady for Development
The testing infrastructure is now ready for developers to start writing:
tests/unit/tests/integration/conftest.py