feat: Set up Python testing infrastructure with Poetry and pytest #26
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 text-to-SQL models project using Poetry for dependency management and pytest as the testing framework.
Changes Made
Package Management
package-mode = false
(dependency management only)pyproject.toml
with project metadata and dependenciesTesting Framework Setup
Directory Structure:
pytest Configuration:
test_*.py
and*_test.py
unit
,integration
,slow
Test Fixtures (conftest.py)
Created comprehensive fixtures for common testing scenarios:
temp_dir
: Temporary directory managementsample_csv_file
: CSV file creation for testingsample_sqlite_db
: SQLite database with test datamock_config
: Configuration dictionarymock_api_request
/mock_sql_response
: API testing helpersmock_model_predictions
: Model output mockingreset_environment
: Environment variable isolationcaptured_logs
: Log capture utilitymock_http_response
: HTTP response mockingValidation
test_infrastructure.py
with 12 validation testsOther Changes
.gitignore
with comprehensive Python patternsHow to Use
Install dependencies:
Run all tests:
or
Run specific test categories:
poetry run pytest -m unit poetry run pytest -m integration poetry run pytest -m "not slow"
Run with coverage (when ready):
Notes
Next Steps
tests/unit/
tests/integration/