feat: Add comprehensive Python testing infrastructure with Poetry#9
Open
llbbl wants to merge 1 commit into
Open
feat: Add comprehensive Python testing infrastructure with Poetry#9llbbl wants to merge 1 commit into
llbbl wants to merge 1 commit into
Conversation
- Set up Poetry package manager with pyproject.toml configuration - Add testing dependencies (pytest, pytest-cov, pytest-mock) - Configure pytest with coverage reporting and custom markers - Create testing directory structure (tests/unit, tests/integration) - Add comprehensive pytest fixtures in conftest.py - Update .gitignore with testing and Poetry artifacts - Add Makefile with convenient testing commands - Include validation tests to verify 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 establishes a comprehensive testing infrastructure for the Python 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, mocking capabilities, and organized test structure.
Changes Made
Package Management
pyproject.tomlpoetry.lockfor reproducible installationsTesting Framework
Testing Configuration (
pyproject.toml)unit,integration, andslowfor test categorizationProject Structure
Shared Fixtures (
conftest.py)temp_dir: Temporary directory managementsample_config: Mock configuration dictionarymock_config_file: YAML config file fixturesample_image_tensor: PyTorch tensor fixturessample_batch: Batch data fixturessample_keypoints: Keypoint data fixturesmock_checkpoint: Model checkpoint fixturesample_video_frames: Video frame data fixturemock_dataset_path: Dataset directory structuremock_logger: Logging fixturereset_random_seeds: Reproducible random seedsDevelopment Tools
make install: Install dependenciesmake test/make tests: Run all testsmake test-unit: Run unit tests onlymake test-integration: Run integration tests onlymake coverage: Generate coverage reportmake lint: Run code lintingmake format: Format code with black and isortmake typecheck: Run type checkingmake clean: Clean cache and build filesAdditional Configuration
How to Use
Installation
Running Tests
Writing Tests
tests/unit/tests/integration/conftest.pyfor common test dataValidation
The setup includes
test_setup_validation.pywhich verifies:Run validation:
poetry run pytest tests/test_setup_validation.py -vDependencies Added
Testing Dependencies (dev)
Code Quality Tools (dev)
Notes