feat: Set up comprehensive Python testing infrastructure #9
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 comprehensive Python testing infrastructure
Summary
This PR establishes a complete testing infrastructure for the ML/NLP projects collection, providing a solid foundation for writing and running tests across all modules (chatbot, embeddings, machine translation, pos tagging, sentiment analysis, and text generation).
Changes Made
Package Management
pyproject.toml
with Poetry as the package managerTesting Configuration
test_*.py
and*_test.py
htmlcov/
,coverage.xml
)@pytest.mark.unit
,@pytest.mark.integration
,@pytest.mark.slow
Directory Structure
Testing Fixtures (conftest.py)
Comprehensive set of ML/NLP-focused fixtures:
temp_dir
,temp_checkpoint_dir
,sample_text_file
sample_tensorflow_tensor
,sample_torch_tensor
,sample_numpy_array
sample_config
,mock_model_config
,sample_yaml_config
sample_text_data
,sample_dataset_info
,small_batch_data
,mock_tokenizer
reset_random_seeds
(auto-applied to all tests)Additional Improvements
test_infrastructure.py
with 16 tests verifying all components work correctlyRunning Tests
Basic Commands
Coverage Reports
htmlcov/index.html
coverage.xml
Verification
The infrastructure has been validated with comprehensive tests covering:
Next Steps
Developers can now:
tests/unit/
for individual functions and classestests/integration/
for module interactionsconftest.py
for common test data and configurationspoetry run pytest
to ensure code qualityNotes