feat: Set up complete Python testing infrastructure with Poetry#62
Open
llbbl wants to merge 1 commit intosml2h3:mainfrom
Open
feat: Set up complete Python testing infrastructure with Poetry#62llbbl wants to merge 1 commit intosml2h3:mainfrom
llbbl wants to merge 1 commit intosml2h3:mainfrom
Conversation
- Add Poetry package manager configuration (pyproject.toml) - Configure pytest with coverage reporting and custom markers - Create testing directory structure (tests/unit, tests/integration) - Add comprehensive pytest fixtures in conftest.py - Set up Poetry script commands for running tests - Add validation tests to verify infrastructure setup - Update .gitignore with Claude-specific entries - Migrate dependencies from requirements.txt to Poetry
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 sets up a complete testing infrastructure for the Python project using Poetry as the package manager and pytest as the testing framework. The setup provides a ready-to-use testing environment where developers can immediately start writing tests.
Changes Made
Package Management
pyproject.tomlrequirements.txtto Poetrypoetry.lockfile for reproducible buildsTesting Framework
Configuration
test_*.pyor*_test.pypatternsconfigs,tools, andutilsmodulesnetsandprojectsdue to external dependenciesunit,integration, andslowmarkers for test categorizationDirectory Structure
Fixtures Available
The
conftest.pyfile provides these reusable fixtures:temp_dir: Temporary directory for test filesmock_config: Mock configuration dictionarysample_yaml_config: Creates a sample YAML config filemock_image_path: Mock image file pathmock_checkpoint_path: Mock checkpoint file pathsample_project_structure: Creates project directory structurereset_modules: Auto-resets module imports between testscapture_logs: Captures loguru logs for testingmock_training_data: Provides mock training dataHow to Use
Installation
Running Tests
Coverage Reports
After running tests, coverage reports are available in:
htmlcov/index.html(open in browser)coverage.xml(for CI/CD integration)Notes
Dependencies: The project has some modules (
nets) that require PyTorch, which isn't included in the base dependencies. These are excluded from coverage reporting.Python Version: Requires Python 3.8 or higher
Poetry Lock File: The
poetry.lockfile should be committed to ensure consistent dependency versions across environmentsTest Organization: Tests should be organized into
unit/andintegration/subdirectories based on their scopeNext Steps
Developers can now:
tests/unit/tests/integration/