feat: Set up comprehensive Python testing infrastructure with Poetry #32
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 RecurrentGPT project using Poetry as the package manager and pytest as the testing framework. The setup provides a solid foundation for writing and maintaining tests throughout the project lifecycle.
Changes Made
Package Management
pyproject.tomlwith Poetry as the package managerTesting Framework Setup
Directory Structure:
tests/directory with proper Python package initializationtests/unit/andtests/integration/subdirectories for organized test structurePytest Configuration:
@pytest.mark.unit,@pytest.mark.integration,@pytest.mark.slowCoverage Configuration:
Shared Test Fixtures
Created
tests/conftest.pywith comprehensive fixtures including:temp_dir: Temporary directory managementmock_config: Mock configuration datamock_init_prompt: Mock prompt JSON datamock_paragraphs: Mock paragraph generation resultsmock_openai_response: Mock OpenAI API responsesmock_embedder: Mock SentenceTransformertest_file: Temporary file creation helpermock_env_vars: Environment variable mockingmock_writer_input&mock_human_input: Mock data for core componentscleanup_cache: Automatic cache cleanup between testsmock_gradio_request: Mock Gradio request objectscapture_stdout: Stdout capture for testing print statementsAdditional Changes
Updated .gitignore: Added comprehensive ignore patterns for:
.claude/*)Bug Fix: Fixed missing
osimport inutils.pyValidation Tests: Created
tests/test_setup_validation.pyto verify the testing infrastructure works correctlyHow to Use
Running Tests
Writing New Tests
tests/unit/directorytests/integration/directoryconftest.py@pytest.mark.unit, etc.)Example test structure:
Notes
htmlcov/) and XML (coverage.xml) formatsNext Steps
With this testing infrastructure in place, the team can now: