feat: set up comprehensive Python testing infrastructure with Poetry #84
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 P3 (Programming Puzzles and Code Competitions) project using Poetry as the package manager and pytest as the testing framework.
Changes Made
Package Management
pyproject.toml
with Poetry configurationTesting Configuration
pytest Configuration:
test_*.py
and*_test.py
filesCoverage Configuration:
generators
andsolvers
Directory Structure
Shared Fixtures (conftest.py)
temp_dir
: Temporary directory for test filestemp_file
: Temporary file with test contentmock_config
: Mock configuration dictionarysample_puzzle_data
: Sample puzzle data for testingsample_code_snippet
: Sample code for testingmock_environment_variables
: Mock environment variablesproject_root
,generators_path
,solvers_path
: Path fixturesclean_imports
: Import cleanup for test isolationreset_random_seed
: Reproducible random seedsPoetry Commands
poetry run test
- Run all testspoetry run tests
- Alternative command (both work)Additional Configuration
.gitignore
with:.pytest_cache/
,coverage.xml
,htmlcov/
).claude/*
)poetry.lock
is NOT ignored (should be in version control)Testing the Infrastructure
Installation
Running Tests
Validation Tests
The PR includes comprehensive validation tests that verify:
Notes
orderedset Dependency: The
orderedset
package from the original requirements had build issues on the current platform. It has been commented out in favor of using Python's built-inOrderedDict
when needed.Coverage Thresholds: The 80% coverage threshold has been temporarily disabled in the configuration since this PR only sets up the infrastructure without implementing actual tests for the codebase.
Deprecation Warnings: Some existing code has deprecation warnings (invalid escape sequences). These are from the existing codebase and should be addressed in a separate PR.
Next Steps
With this testing infrastructure in place, developers can now:
The infrastructure is designed to be extensible and can be enhanced with additional fixtures, plugins, and configurations as needed.