feat: Add comprehensive Python testing infrastructure with Poetry#27
Open
llbbl wants to merge 1 commit intoKiteretsu77:mainfrom
Open
feat: Add comprehensive Python testing infrastructure with Poetry#27llbbl wants to merge 1 commit intoKiteretsu77:mainfrom
llbbl wants to merge 1 commit intoKiteretsu77:mainfrom
Conversation
- Set up Poetry as package manager with pyproject.toml configuration - Add pytest, pytest-cov, and pytest-mock as dev dependencies - Configure pytest with custom markers (unit, integration, slow) - Set up coverage reporting with 80% threshold and HTML/XML output - Create test directory structure with shared fixtures in conftest.py - Update .gitignore with testing and development patterns - 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 anime enhancement project using Poetry as the package manager and pytest as the testing framework. The setup provides a solid foundation for writing and running tests with coverage reporting.
Changes Made
Package Management
pyproject.tomlwith Poetry configurationrequirements.txtto PoetryTesting Dependencies
Added as development dependencies:
pytest ^8.0.0- Main testing frameworkpytest-cov ^4.1.0- Coverage reportingpytest-mock ^3.12.0- Mocking utilitiesTesting Configuration
Pytest Configuration
test_*.pyfilesunit- For fast, isolated unit testsintegration- For tests requiring external resourcesslow- For long-running testsCoverage Configuration
architecture,degradation,loss,test_code,train_codehtmlcov/), and XML (coverage.xml)Directory Structure
Shared Fixtures (conftest.py)
temp_dir- Temporary directory for test filessample_image- Generate test imagessample_tensor- PyTorch tensor fixturesmock_config- Configuration dictionary fixturemock_model_weights- Mock model weights filereset_torch_seed- Reproducible random seedsdevice- GPU/CPU device selectioncleanup_gpu- GPU memory cleanupDevelopment Scripts
poetry run test- Run all tests with coveragepoetry run tests- Alternative command (both work)Updated .gitignore
Added patterns for:
.pytest_cache/,.coverage,htmlcov/, etc.).claude/)Usage Instructions
Install dependencies:
Run tests:
Run specific test categories:
View coverage reports:
htmlcov/index.htmlin browsercoverage.xmlfor CI integrationNotes
-vfor verbose,-xto stop on first failure)poetry.lock) is committed to ensure reproducible environments