Conversation
Replace Docker-based mocking (MailHog SMTP, mock OpenAI) with pure Python stub factories using SimpleNamespace and monkeypatch. Create conftest hierarchy with session-scoped Hydra config composition. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Reorganize tests to mirror source structure. Migrate tests from old files (test_glob_match, test_include_path, test_llm, test_email) into module-aligned files. Add new tests for previously untested modules (construct_email, main, biorxiv/medrxiv retrievers, base reranker). Add E2E test exercising full pipeline: Zotero -> retrieve -> rerank -> TLDR -> email. Fix RSS fixture to include "new" announce type entries so test_arxiv_retriever actually exercises the retriever (was passing vacuously with 0 papers before). 77 tests total, 86% coverage. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove MailHog and mock_openai service containers from CI workflow. Replace @pytest.mark.ci with @pytest.mark.slow for model-download tests. Add pytest-cov dev dependency. Update CLAUDE.md testing docs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Overhauls the test suite to remove Docker/external-service dependencies by replacing them with pure-Python stubs/fixtures, while adding coverage reporting and simplifying CI.
Changes:
- Replaced Docker-based OpenAI/SMTP/Zotero mocking with
SimpleNamespace+monkeypatchstubs and shared factories. - Reorganized tests to mirror the
src/zotero_arxiv_daily/module structure and added new coverage (executor, main, protocol, retrievers, rerankers, email construction). - Simplified CI by removing service containers and adding
pytest-covcoverage reporting.
Reviewed changes
Copilot reviewed 24 out of 28 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
uv.lock |
Adds locked dependencies for coverage and pytest-cov to support coverage reporting. |
pyproject.toml |
Switches default marker exclusion to not slow and adds pytest-cov to dev deps. |
.github/workflows/ci.yml |
Removes Docker services and runs pytest with coverage enabled. |
CLAUDE.md |
Adds repo workflow/testing guidance and run commands for contributors/tools. |
tests/conftest.py |
Adds session-scoped Hydra config composition + function-scoped deep copies. |
tests/canned_responses.py |
Centralizes stub factories for OpenAI, Zotero, SMTP + canned API responses. |
tests/test_utils.py |
New tests for utils (glob_match, send_email, extract_tex_code_from_tar). |
tests/test_protocol.py |
New tests for Paper.generate_tldr and Paper.generate_affiliations using stub OpenAI. |
tests/test_main.py |
New tests for main entrypoint behavior via __wrapped__ to bypass Hydra. |
tests/test_executor.py |
New tests for include/ignore path normalization, corpus filtering, Zotero fetch, and E2E Executor.run(). |
tests/test_construct_email.py |
New tests for HTML email rendering helpers and empty-email behavior. |
tests/retriever/conftest.py |
Adds retriever-specific fixtures for offline feedparser/requests stubbing. |
tests/retriever/test_arxiv_retriever.py |
Updates arXiv retriever tests to stay offline by mocking arxiv client + extraction. |
tests/retriever/test_base_retriever.py |
Adds tests for base retriever error handling, serial execution, and registration lookup. |
tests/retriever/test_biorxiv_retriever.py |
Adds tests for bioRxiv retriever filtering/convert behavior and required config. |
tests/retriever/test_medrxiv_retriever.py |
Adds tests for medRxiv retriever server/pdf URL composition. |
tests/reranker/conftest.py |
Adds reranker-specific fixture to patch OpenAI import site for API reranker. |
tests/reranker/test_api_reranker.py |
Replaces CI-only test with stubbed OpenAI embedding tests + batching coverage. |
tests/reranker/test_base_reranker.py |
Adds deterministic tests for rerank sorting, time-decay weighting, and unknown reranker lookup. |
tests/reranker/test_local_reranker.py |
Marks local reranker test as slow (model download) and normalizes assertions. |
tests/test_llm.py |
Removes legacy OpenAI-integration tests that required external services/CI marker. |
tests/test_email.py |
Removes legacy email tests that relied on external behavior/CI marker. |
tests/test_include_path.py |
Removes legacy include/ignore path tests migrated into tests/test_executor.py. |
tests/test_glob_match.py |
Removes legacy glob-match tests migrated into tests/test_utils.py. |
tests/retriever/arxiv_rss_example.xml |
Fixes/extends RSS fixture so arXiv tests exercise non-vacuous paper parsing. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| ```bash | ||
| # Run the application | ||
| uv run src/zotero_arxiv_daily/main.py |
There was a problem hiding this comment.
uv run src/zotero_arxiv_daily/main.py is unlikely to work reliably because uv run expects an executable command; a Python file without a shebang/execute bit typically won’t run. Consider documenting uv run python src/zotero_arxiv_daily/main.py or uv run python -m zotero_arxiv_daily.main instead.
| uv run src/zotero_arxiv_daily/main.py | |
| uv run python -m zotero_arxiv_daily.main |
| ## Git Workflow | ||
|
|
||
| - PRs should target the `dev` branch, not `main` | ||
| - Current development branch: `dev` |
There was a problem hiding this comment.
This doc says PRs should target dev, but the CI workflow currently runs only for pushes/PRs against main. Either update the workflow triggers to include dev or clarify here that CI won’t run for PRs targeting dev as-is.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Summary
Complete test suite overhaul that eliminates Docker dependencies and achieves 86% code coverage:
Test Infrastructure
tests/canned_responses.pywith shared stub factories for OpenAI, Zotero, and SMTPTest Migration & New Coverage
CI Simplification
@pytest.mark.ciwith@pytest.mark.slowfor model-download testsTest Coverage
77 tests, 86% coverage. All tests run locally with
uv run pytest(no Docker needed).Pre-Landing Review
No issues found.
Plan Completion
28/28 plan items completed.
Test plan
@pytest.mark.cimarkers remainunittest.mockimports in test files🤖 Generated with Claude Code