feat: Set up comprehensive Python testing infrastructure - #4
Open
llbbl wants to merge 1 commit into
Open
Conversation
- Add Poetry package manager with pyproject.toml configuration - Migrate existing dependencies from requirements.txt - Add pytest, pytest-cov, and pytest-mock as dev dependencies - Configure pytest with coverage reporting (80% threshold) - Set up testing directory structure (tests/unit, tests/integration) - Create shared fixtures in conftest.py for common test utilities - Add comprehensive .gitignore for Python projects and testing artifacts - Include validation tests to verify setup functionality - Configure HTML and XML coverage report generation
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 Flask-based tarot webapp, providing developers with a robust foundation for writing and running tests.
Changes Made
Package Management
pyproject.tomlconfigurationrequirements.txtto Poetry formatTesting Framework
Testing Configuration
pyproject.toml:test_*.pyand*_test.pyfilesunit,integration,slow)webapppackageDirectory Structure
Shared Test Fixtures
The
tests/conftest.pyprovides common fixtures:temp_dir- Temporary directory for file operationstemp_file- Temporary file with test contentmock_config- Mock configuration objectmock_flask_app- Mock Flask app instanceclean_environment- Environment variable cleanupsample_data- Sample data for testingUpdated Configuration
Running Tests
Install Dependencies
Run All Tests
Run Tests Without Coverage
Run Specific Test Categories
Generate Coverage Reports
Coverage reports are automatically generated:
htmlcov/index.htmlcoverage.xmlValidation
The setup includes validation tests (
test_setup_validation.py) that verify:All validation tests pass successfully, confirming the infrastructure is ready for use.
Notes
requirements.txtis preserved for compatibilitypyproject.tomlNext Steps
Developers can now:
webapp/cards.pyandwebapp/routes.py