feat: Set up comprehensive Python testing infrastructure with Poetry #28
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 Samba model project using Poetry for dependency management and pytest as the testing framework. The setup provides a solid foundation for writing and organizing tests with proper tooling and configuration.
Changes Made
1. Package Management
pyproject.tomlwith Poetry configuration2. Testing Framework Setup
3. Testing Configuration
pyproject.toml:unit,integration,slowlit_gpt4. Directory Structure
5. Shared Fixtures (
conftest.py)temp_dir: Temporary directory for test filesmock_config: Mock configuration dictionarymock_model_config: Mock Config objectdevice: PyTorch device (CPU/CUDA)sample_tensor: Sample PyTorch tensormock_tokenizer: Mock tokenizer implementationmock_checkpoint: Mock checkpoint filesample_text_data: Sample text for testingmock_wandb: Mock Weights & Biases integrationmock_dataset: Mock dataset filereset_environment: Environment reset between testscapture_stdout: Stdout capture utility6. Poetry Scripts
poetry run test- Run all testspoetry run tests- Alternative command (both work)7. Additional Setup
.gitignorewith testing and Claude-related entriesHow to Use
Installation
Running Tests
Writing Tests
tests/unit/tests/integration/conftest.pyNotes
lit_gptis skipped as it requires CUDA dependencies.Next Steps