feat: set up complete Python testing infrastructure #7
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 complete testing infrastructure for the ML project using Poetry as the package manager and pytest as the testing framework.
Changes Made
Package Management
pyproject.tomlconfigurationrequirements.txtto Poetry format with proper version constraintspytest,pytest-cov,pytest-mock>=3.8,<3.12for TensorFlow compatibilityTesting Configuration
pyproject.toml:test_*.pyand*_test.pyfilesunit,integration,slowDirectory Structure
Shared Testing Fixtures
conftest.pywith ML/AI-specific fixtures:temp_dir,temp_file- Temporary filesystem utilitiesmock_wandb- Mock Weights & Biases loggingmock_tensorflow- Mock TensorFlow importsmock_huggingface_hub- Mock Hugging Face Hub operationsmock_dvc- Mock DVC operationssample_data- Sample ML training/test datasample_params,sample_config_file- Configuration utilitiesDevelopment Commands
poetry run test- Run all testspoetry run tests- Alternative commandProject Configuration
.gitignorewith testing patterns:.pytest_cache/,.coverage,htmlcov/__pycache__/,*.pyc, virtual environments.claude/*Validation
Testing Instructions
Running Tests
Coverage Reports
htmlcov/directorycoverage.xmlfor CI/CD integrationWriting New Tests
tests/unit/tests/integration/conftest.py@pytest.mark.unit,@pytest.mark.integration,@pytest.mark.slowDependencies
Production Dependencies (from requirements.txt)
dvc[gdrive]==2.10.2- Data version controlwandb==0.12.19- Experiment trackingtensorflow==2.8- ML frameworktyper==0.4.1- CLI frameworkdocopt==0.6.2- Command line parsinghuggingface-hub- Model hub integrationTesting Dependencies (new)
pytest ^7.4.0- Testing frameworkpytest-cov ^4.1.0- Coverage reportingpytest-mock ^3.11.0- Mocking utilitiesNotes
>=3.8,<3.12due to TensorFlow compatibility requirementspyproject.tomlFuture Improvements