feat: Set up Python testing infrastructure with Poetry and pytest#10
Open
llbbl wants to merge 1 commit intolouisnino:masterfrom
Open
feat: Set up Python testing infrastructure with Poetry and pytest#10llbbl wants to merge 1 commit intolouisnino:masterfrom
llbbl wants to merge 1 commit intolouisnino:masterfrom
Conversation
- Configure Poetry as package manager with pyproject.toml - Add pytest, pytest-cov, and pytest-mock as dev dependencies - Set up comprehensive pytest configuration with coverage thresholds - Create testing directory structure (tests/, unit/, integration/) - Add shared fixtures in conftest.py for common test patterns - Configure Poetry scripts for running tests via 'poetry run test(s)' - Update .gitignore with testing and Poetry artifacts - Add validation tests to verify setup functionality
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 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: