feat: Add comprehensive Python testing infrastructure #25
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 establishes a complete testing infrastructure for the LLMCompiler project, providing a solid foundation for writing and maintaining tests. The setup includes Poetry for dependency management, pytest for testing, coverage reporting, and a well-organized test directory structure.
Changes Made
Package Management
pyproject.tomlwith Poetry configurationrequirements.txtto Poetrybs4,langchain,langchain-community,numexpr,tiktoken,openaipytest,pytest-cov,pytest-mockpoetry run testandpoetry run tests)Testing Configuration
pytest configuration with:
@pytest.mark.unit,@pytest.mark.integration,@pytest.mark.slowCoverage configuration with:
src/directoryhtmlcov/, XML incoverage.xml, terminal output)Directory Structure
Shared Fixtures (
tests/conftest.py)Comprehensive set of reusable fixtures including:
temp_dir,temp_file,mock_dataset_pathmock_env_varsfor API keys and configurationmock_llm_client,mock_openai_response,mock_function_registrysample_config,sample_tools_config,sample_task_listcapture_logs,reset_environmentValidation Tests
Created
tests/test_infrastructure.pywith 18 tests validating:Other Updates
.gitignoreto exclude:.pytest_cache/,.coverage,htmlcov/,coverage.xml.claude/*for Claude Code configurationRunning Tests
Install dependencies:
Run all tests:
Run specific test files:
Run tests with specific markers:
Run tests without coverage:
Generate coverage report:
Validation Results
All 18 infrastructure validation tests pass successfully:
Next Steps
The testing infrastructure is now ready to use! Developers can:
tests/unit/for individual componentstests/integration/for component interactionstests/conftest.pyto simplify test setup@pytest.mark.unit,@pytest.mark.integration, or@pytest.mark.slowpoetry run testNotes
requirements.txtremains for reference but is superseded bypyproject.toml.pyproject.tomlunder[tool.pytest.ini_options]by modifying--cov-fail-under=80.poetry.lockis tracked in version control to ensure all developers use the same dependency versions.Questions or Concerns?
Feel free to request changes, ask questions, or provide feedback. I'm happy to adjust any part of this setup to better fit your project's needs!