feat: Set up Python testing infrastructure with Poetry and pytest #10
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 reinforcement learning project using Poetry and pytest. The setup provides a solid foundation for writing unit and integration tests, with proper coverage reporting and modern Python tooling.
Changes Made
Package Management
pyproject.tomlwith project metadata and dependenciesTesting Framework
Configuration
pyproject.toml:Directory Structure
Shared Fixtures
Created comprehensive fixtures in
conftest.py:project_root- Project root directory pathtemp_dir- Temporary directory with automatic cleanupmock_config- Mock configuration for testingsample_game_state- Sample game state datamock_network- Mock neural networkmock_env- Mock environmentreset_random_seed- Automatic random seed resetcapture_stdout- Stdout capture for testing print statementsmock_model_save/load- Model persistence mockingDeveloper Experience
poetry run testorpoetry run testsVersion Control
.gitignorewith:__pycache__,*.pyc, etc.).pytest_cache,.coverage,htmlcov/).claude/*)How to Use
Install dependencies:
Run all tests:
Run specific test markers:
Run with coverage report:
View HTML coverage report:
Notes
poetry.lock) is tracked in git for reproducible builds.Next Steps
With this infrastructure in place, developers can now: