feat: Set up comprehensive Python testing infrastructure#40
Open
llbbl wants to merge 1 commit into
Open
Conversation
- Add Poetry as package manager with pyproject.toml configuration - Configure pytest with coverage reporting (80% threshold) - Create testing directory structure (tests/unit, tests/integration) - Add comprehensive pytest fixtures in conftest.py - Configure test markers (unit, integration, slow) - Update .gitignore with testing and Claude-specific entries - Add validation tests to verify infrastructure setup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Add Python Testing Infrastructure
Summary
This PR sets up a comprehensive testing infrastructure for the Mamba Chat project, providing developers with a ready-to-use testing environment that follows Python best practices.
Changes Made
Package Management
pyproject.tomlwith full Poetry configurationrequirements.txt(as they have CUDA-specific requirements)Testing Framework
Configuration
test_*.pyor*_test.pypatterns@pytest.mark.unit- Fast, isolated unit tests@pytest.mark.integration- Tests requiring external resources@pytest.mark.slow- Long-running tests (skipped by default)Directory Structure
Fixtures
Created comprehensive fixtures in
conftest.py:temp_dir- Temporary directory for test filestemp_file- Helper to create temporary filesmock_config- Mock configuration objectmock_model- Mock ML modelmock_tokenizer- Mock tokenizermock_dataset- Mock datasetisolated_filesystem- Run tests in isolated directorycapture_logs- Capture log output during testsAdditional Setup
.gitignorewith testing artifacts and Claude-specific entries--runslowflag to run slow testsHow to Use
Install Dependencies
Run Tests
View Coverage Reports
htmlcov/index.htmlin your browsercoverage.xmlfor CI integrationNotes
Production Dependencies: The main project dependencies (torch, transformers, etc.) remain in
requirements.txtdue to their CUDA-specific requirements. This testing infrastructure is focused on development dependencies only.Coverage Threshold: Set to 80% by default. Tests will fail if coverage drops below this threshold.
Slow Tests: Tests marked with
@pytest.mark.sloware skipped by default to keep the test suite fast. Use--runslowto include them.Package Structure: Created a minimal
mamba_chatpackage directory to satisfy Poetry's requirements. The actual project code structure can be organized as needed.Next Steps
Developers can now immediately start writing tests by:
tests/unit/ortests/integration/conftest.py@pytest.mark.unit,@pytest.mark.integration, or@pytest.mark.slow