feat: Set up complete Python testing infrastructure with Poetry#11
Open
llbbl wants to merge 1 commit intomajacinka:mainfrom
Open
feat: Set up complete Python testing infrastructure with Poetry#11llbbl wants to merge 1 commit intomajacinka:mainfrom
llbbl wants to merge 1 commit intomajacinka:mainfrom
Conversation
- Configure Poetry as package manager with all project dependencies - Add pytest, pytest-cov, and pytest-mock as development dependencies - Create comprehensive pytest configuration with coverage thresholds - Establish testing directory structure with unit/integration separation - Add shared fixtures in conftest.py for common test patterns - Configure test markers for categorizing tests (unit, integration, slow) - Update .gitignore with testing and Poetry-related entries - Add validation tests to verify infrastructure setup
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.
Set Up Python Testing Infrastructure
Summary
This PR establishes a complete testing infrastructure for the Python newsletter automation project using Poetry as the package manager and pytest as the testing framework.
Changes Made
Package Management
pyproject.tomlwith Poetry configurationpoetry.lockfor reproducible buildsTesting Setup
pytest-covfor code coverage reportingpytest-mockfor mocking utilitiesDirectory Structure
Shared Fixtures (conftest.py)
temp_dir: Temporary directory for test filesmock_env_vars: Mock environment variablesmock_config: Mock configuration dictionarymock_langchain_llm: Mock LangChain LLMmock_crewai_agent: Mock CrewAI Agentmock_crewai_task: Mock CrewAI Taskmock_reddit_client: Mock Reddit (PRAW) clientsample_newsletter_data: Sample data for testingcapture_logs: Log capture fixtureCommands
poetry run test- Run all tests with coveragepoetry run tests- Alternative command (both work)poetry run pytest- Direct pytest executionAdditional Configuration
.gitignorewith testing artifacts and Poetry filesTesting Instructions
Install Poetry if not already installed:
curl -sSL https://install.python-poetry.org | python3 -Install dependencies:
Run tests:
View coverage report:
htmlcov/index.htmlin a browsercoverage.xmlfor CI/CD integrationNotes
testandtestscommands are available as requested