feat: Set up comprehensive Python testing infrastructure with Poetry#249
Open
llbbl wants to merge 1 commit intomicrosoft:mainfrom
Open
feat: Set up comprehensive Python testing infrastructure with Poetry#249llbbl wants to merge 1 commit intomicrosoft:mainfrom
llbbl wants to merge 1 commit intomicrosoft:mainfrom
Conversation
- Configure Poetry as package manager with pyproject.toml - Add pytest, pytest-cov, and pytest-mock as test dependencies - Set up pytest configuration with coverage thresholds (80%) - Create test directory structure with unit/integration separation - Add comprehensive pytest fixtures in conftest.py - Configure test markers (unit, integration, slow) - Update .gitignore with testing and Claude entries - Add Poetry scripts for running tests (test/tests commands) - Create 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.
Set Up Python Testing Infrastructure
Summary
This PR establishes a comprehensive testing infrastructure for the SSOD (Semi-Supervised Object Detection) Python project using Poetry as the package manager and pytest as the testing framework.
Changes Made
Package Management
pyproject.tomlwith Poetry as the package managerrequirements.txtto PoetryTesting Framework
Project Structure
Configuration
pytest Configuration (in pyproject.toml)
unit,integration,slowCoverage Configuration
ssodpackage__init__.py, and common patternshtmlcov/Testing Fixtures (conftest.py)
Created comprehensive fixtures for common testing needs:
temp_dir/temp_file: Temporary file system resourcesmock_config: Sample configuration dictionarymock_model/mock_dataset/mock_dataloader: PyTorch mockssample_json_file: JSON test datamock_wandb: Weights & Biases mockingmock_torch_save/mock_torch_load: PyTorch I/O mockingdevice/sample_tensor/sample_batch: PyTorch helpersreset_torch_seed: Reproducible testscapture_logs: Log output testingmock_os_environ: Environment variable testingAdditional Files
How to Use
Install Dependencies
Run Tests
View Coverage Report
After running tests with coverage, open
htmlcov/index.htmlin a browser to view the detailed coverage report.Validation
The infrastructure includes validation tests (
test_infrastructure_validation.py) that verify:Notes
unit/orintegration/directories