feat: Add comprehensive Python testing infrastructure with Poetry #18
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 OCR dataset tools project using Poetry as the package manager and pytest as the testing framework.
Changes Made
Package Management
pyproject.tomlwith Poetry configuration as the project's package managerTesting Configuration
pytest Configuration: Set up pytest with:
test_*.pyand*_test.pyfilesCoverage Settings: Configured coverage to:
convertanddatasetpackages__init__.pyfrom coverageDirectory Structure
Fixtures (in conftest.py)
temp_dir: Creates temporary directory for test filessample_image: Generates test imagessample_detection_json: Creates detection JSON test datasample_recognition_txt: Creates recognition text test datamock_dataset_config: Provides mock configurationsample_points: Creates polygon point arraysmock_lmdb_env: Mocks LMDB database environmentreset_modules: Cleans module imports between testscapture_stdout: Captures print output for testingAdditional Changes
.pytest_cache/,coverage.xml,htmlcov/).claude/*)poetry.lockis intentionally NOT ignoredHow to Use
Installing Dependencies
Running Tests
Both commands are available and will run the same test suite:
Test Options
All standard pytest options are available:
Notes
Coverage Threshold: Currently set to 0% to allow infrastructure setup. Should be changed to 80% in
pyproject.tomlwhen actual tests are written.Validation Tests: The included
test_setup_validation.pyverifies that the testing infrastructure is properly configured and all dependencies are correctly installed.Next Steps: Developers can now immediately start writing unit and integration tests for the
convertanddatasetpackages using the provided infrastructure.Poetry Lock File: The
poetry.lockfile will be generated on first install and should be committed to ensure reproducible builds.