feat: Add complete Python testing infrastructure with Poetry #26
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 Complete Python Testing Infrastructure
Summary
This PR sets up a comprehensive testing infrastructure for the ResNet project using Poetry as the package manager and pytest as the testing framework. The setup provides a solid foundation for writing and maintaining tests with proper coverage reporting and test organization.
Changes Made
Package Management
pyproject.toml
with Poetry configuration as the project's package managerpoetry run test
andpoetry run tests
commands for running testsTesting Configuration
pytest Configuration:
test_*.py
and*_test.py
filesunit
,integration
, andslow
for test categorizationCoverage Configuration:
Directory Structure
Fixtures and Testing Utilities
Created comprehensive fixtures in
conftest.py
:temp_dir
: Temporary directory managementsample_image_path
: Mock image file creationmock_model_config
: Model configuration for testingmock_dataset_config
: Dataset configuration for testingdevice
: PyTorch device selectionsample_tensor
&sample_batch
: Test data generationreset_random_seeds
: Reproducibility fixturemock_checkpoint
: Model checkpoint creationenvironment_setup
: Environment variable managementAdditional Files
.gitignore
: Comprehensive Python gitignore with testing artifacts, IDE files, and project-specific patternsCLAUDE.md
: Documentation for Claude AI with testing commands and project structureHow to Use
Install dependencies:
Run tests:
View coverage reports:
htmlcov/index.html
in browsercoverage.xml
for CI integrationNext Steps
With this infrastructure in place, developers can now:
Notes
pyproject.toml