Add comprehensive Python testing infrastructure with Poetry#71
Open
llbbl wants to merge 1 commit intoSakanaAI:mainfrom
Open
Add comprehensive Python testing infrastructure with Poetry#71llbbl wants to merge 1 commit intoSakanaAI:mainfrom
llbbl wants to merge 1 commit intoSakanaAI:mainfrom
Conversation
Set up complete testing environment including: - Poetry package manager configuration with all project dependencies - pytest, pytest-cov, and pytest-mock testing frameworks - Organized test directory structure (tests/unit/, tests/integration/) - Comprehensive pytest configuration with custom markers (unit, integration, slow) - Coverage reporting (HTML, XML, terminal) with 80% target threshold - Shared pytest fixtures in conftest.py (temp_dir, mock_config, etc.) - Infrastructure validation tests to verify setup - Updated .gitignore for test artifacts and Claude Code files Developers can now run tests using: - `poetry run test` or `poetry run tests` - All standard pytest options are available
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.
About UnitSeeker
Hi! This PR is part of the UnitSeeker project, a human-guided initiative to help Python repositories establish testing infrastructure.
Key points:
Learn more about the project and see the stats on our progress at https://unitseeker.llbbl.com/
Summary
This PR adds a comprehensive testing infrastructure to the AI Scientist project, providing a solid foundation for writing and running tests. The setup uses Poetry for dependency management and pytest as the testing framework.
Changes Made
Package Management
pyproject.tomlwith Poetry setuprequirements.txtto Poetry formatTesting Dependencies
Added the following testing tools as development dependencies:
pytest(v8.0.0+) - Main testing frameworkpytest-cov(v6.0.0+) - Coverage reportingpytest-mock(v3.14.0+) - Enhanced mocking utilitiesDirectory Structure
Created organized test directory layout:
Testing Configuration
Configured pytest in
pyproject.tomlwith:test_*.py,*_test.py)@pytest.mark.unit- Unit tests for isolated components@pytest.mark.integration- Integration tests for multiple components@pytest.mark.slow- Tests with longer execution timesShared Fixtures
Created comprehensive shared fixtures in
tests/conftest.py:temp_dir- Temporary directory for test filestemp_file- Temporary file creationmock_config- Mock configuration dictionariessample_data_dir- Sample data directory with test filesmock_env_vars- Environment variable mockingcapture_logs- Log capture for testingreset_environment- Automatic cleanup between testsValidation Tests
Added
tests/test_infrastructure.pywith tests to verify:Configuration Updates
testandtestscommands for convenience.pytest_cache/,.coverage,htmlcov/,coverage.xml) and Claude Code filesRunning Tests
Install Dependencies
Run All Tests
Run with Specific Options
View Coverage Report
After running tests with coverage, open
htmlcov/index.htmlin your browser to see detailed coverage information.Notes
Coverage Threshold
The 80% coverage threshold is currently commented out in the configuration to allow the infrastructure to be validated without existing tests. Once unit tests are written, uncomment line 97 in
pyproject.toml:# fail_under = 80Poetry Lock File
The
poetry.lockfile has been generated and should be committed to ensure reproducible builds across all environments.Next Steps
This PR provides the testing infrastructure only. Developers can now:
tests/unit/tests/integration/conftest.pypoetry run testValidation
All infrastructure validation tests pass successfully:
testandtestscommands operational🤖 Generated with Claude Code
Co-Authored-By: Claude noreply@anthropic.com