Set up comprehensive Python testing infrastructure with Poetry #19
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.
Python Testing Infrastructure Setup
Summary
This PR sets up a complete testing infrastructure for the rationale benchmark Python project using Poetry as the package manager and pytest as the testing framework.
Changes Made
Package Management
pyproject.tomlwith Poetry as the package managerrequirements.txtto Poetry formatpytest- Main testing frameworkpytest-cov- Coverage reportingpytest-mock- Mocking utilitiesTesting Configuration
pytest Settings: Configured in
pyproject.tomlwith:test_*.pyand*_test.pyfilesunit,integration,slow)Coverage Settings: Comprehensive coverage configuration with:
rationale_benchmarkDirectory Structure
Shared Fixtures (conftest.py)
Created comprehensive fixtures for common testing needs:
temp_dir- Temporary directory managementtemp_file- Temporary file creationmock_config- Configuration mockingsample_json_config- JSON config file generationsample_data- Test data samplesmock_model- Model mockingmock_tokenizer- Tokenizer mockingenvironment_vars- Environment variable managementcapture_logs- Log capturingreset_random_seeds- Automatic seed resetting for reproducibilitymock_file_system- File system structure mockingsample_predictions- Prediction result samplesAdditional Setup
Updated .gitignore: Added entries for:
.pytest_cache/,coverage.xml,htmlcov/).claude/*).vscode/,.idea/, etc.).DS_Store,Thumbs.db)Validation Tests: Created comprehensive validation tests to verify:
How to Use
Installation
Running Tests
Writing Tests
tests/unit/tests/integration/conftest.pyTesting Infrastructure Validation
The setup includes validation tests (
test_setup_validation.py) that verify:All 19 validation tests pass successfully, confirming the infrastructure is ready for use.
Notes
pyproject.tomlpoetry.lock) should be committed to ensure reproducible builds