feat: Set up comprehensive Python testing infrastructure with Poetry#130
Open
llbbl wants to merge 1 commit intofenglinglwb:mainfrom
Open
feat: Set up comprehensive Python testing infrastructure with Poetry#130llbbl wants to merge 1 commit intofenglinglwb:mainfrom
llbbl wants to merge 1 commit intofenglinglwb:mainfrom
Conversation
- Migrate project to Poetry package manager with pyproject.toml - Add pytest, pytest-cov, and pytest-mock as dev dependencies - Configure pytest with coverage reporting (HTML/XML), markers, and settings - Create tests/ directory structure with unit/integration subdirectories - Add comprehensive conftest.py with fixtures for testing ML/CV code - Create validation tests to verify infrastructure setup - Update .gitignore with testing and Poetry-related entries - Configure Poetry scripts for 'poetry run test' and 'poetry run tests'
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 with Poetry
Summary
This PR sets up a comprehensive testing infrastructure for the MAT (Mask-Aware Transformer) 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 proper coverage reporting and organization.
Changes Made
Package Management
pyproject.tomlwith all dependencies fromrequirements.txtpoetry.lockfor reproducible buildsTesting Configuration
pyproject.tomlwith:unit,integration,slowDirectory Structure
Testing Fixtures (in conftest.py)
temp_dir: Temporary directory managementmock_config: Configuration dictionary for testingsample_image,sample_mask: NumPy arrays for image testingsample_tensor_image,sample_tensor_mask: PyTorch tensorsmock_model: Simple PyTorch model for testingmock_dataset_path: Creates mock dataset structuredevice: CPU/GPU device selectionreset_random_seeds: Ensures reproducible testsAdditional Setup
.gitignorewith testing artifacts and Poetry filesHow to Use
Install dependencies:
Run tests:
Run specific test markers:
View coverage reports:
htmlcov/index.htmlin browsercoverage.xmlfor CI/CD integrationNotes
pyproject.tomlNext Steps
Developers can now immediately start writing tests for:
networks/)losses/)metrics/)datasets/)training/)torch_utils/,dnnlib/)