[PR #153] [MERGED] [tests] Add coverage tooling and pytest config #159

Closed
opened 2026-10-13 19:48:08 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Glitchy-Sheep/boosty-downloader/pull/153
Author: @Glitchy-Sheep
Created: 8/15/2026
Status: ✅ Merged
Merged: 8/16/2026
Merged by: @Glitchy-Sheep

Base: main ← Head: test/pytest-infra


📝 Commits (1)

  • 881af48 test: Add coverage tooling and pytest config

📊 Changes

11 files changed (+176 additions, -47 deletions)

View changed files

📝 Taskfile.yml (+5 -0)
📝 pyproject.toml (+17 -0)
📝 test/integration/boosty_api/boosty_api_test.py (+0 -5)
📝 test/integration/flows/full_parse_flow_test.py (+0 -3)
📝 test/unit/boosty_api/client_test.py (+0 -13)
📝 test/unit/file_downloader/extension_guessing_test.py (+2 -4)
📝 test/unit/html_generator/html_templates_test.py (+2 -4)
📝 test/unit/use_cases/check_total_posts_test.py (+0 -3)
📝 test/unit/use_cases/download_all_posts_test.py (+0 -9)
📝 test/unit/use_cases/download_specific_post_test.py (+1 -6)
📝 uv.lock (+149 -0)

📄 Description

[tests] Add coverage tooling and pytest config

Summary

First PR of the test safety-net stage: before restructuring the code we need to see what the tests actually cover and make writing new ones cheap. This adds the tooling only - the missing test categories (cache, filters, golden files, e2e) come in follow-up PRs.

Problem

  • No coverage tooling at all: we cannot tell which code a refactoring would break blind
  • No [tool.pytest.ini_options]: every async test carries a manual @pytest.mark.asyncio, and bare pytest stumbles over integration tests that need live credentials
  • The html renderer test writes test_output.html into the repo root - an interrupted run leaves garbage behind

Fix

  • pytest-cov in dev deps + task test:cov: unit tests with a coverage report, uncovered lines listed (baseline today: 69% total, the post cache is the worst spot at 31-43%)
  • asyncio_mode = "auto": async tests run under asyncio without a mark - 34 manual marks removed
  • testpaths = ["test/unit"]: bare pytest runs only unit tests; task test:api keeps working, its explicit path overrides testpaths
  • -ra --strict-markers: skip/xfail reasons show up in the summary, a typo in a mark fails instead of silently deactivating a test
  • The html test writes into pytest's tmp_path

Verification

  • task ci green: lint, format, pyright, 129 unit tests, build
  • task test:cov produces the report (TOTAL 69%)
  • pytest --collect-only test/integration - all 6 integration tests still collect under auto mode (running them needs live credentials, not part of CI)

Notes

  • No changelog entry: developer-facing tooling only, nothing changes for users (ci/skip-changelog)
  • The coverage threshold gate for CI comes in the last PR of this stage, set from the factual number once the new tests are in

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Glitchy-Sheep/boosty-downloader/pull/153 **Author:** [@Glitchy-Sheep](https://github.com/Glitchy-Sheep) **Created:** 8/15/2026 **Status:** ✅ Merged **Merged:** 8/16/2026 **Merged by:** [@Glitchy-Sheep](https://github.com/Glitchy-Sheep) **Base:** `main` ← **Head:** `test/pytest-infra` --- ### 📝 Commits (1) - [`881af48`](https://github.com/Glitchy-Sheep/boosty-downloader/commit/881af48bf27d838ee10becd14f3252a159ec537d) test: Add coverage tooling and pytest config ### 📊 Changes **11 files changed** (+176 additions, -47 deletions) <details> <summary>View changed files</summary> 📝 `Taskfile.yml` (+5 -0) 📝 `pyproject.toml` (+17 -0) 📝 `test/integration/boosty_api/boosty_api_test.py` (+0 -5) 📝 `test/integration/flows/full_parse_flow_test.py` (+0 -3) 📝 `test/unit/boosty_api/client_test.py` (+0 -13) 📝 `test/unit/file_downloader/extension_guessing_test.py` (+2 -4) 📝 `test/unit/html_generator/html_templates_test.py` (+2 -4) 📝 `test/unit/use_cases/check_total_posts_test.py` (+0 -3) 📝 `test/unit/use_cases/download_all_posts_test.py` (+0 -9) 📝 `test/unit/use_cases/download_specific_post_test.py` (+1 -6) 📝 `uv.lock` (+149 -0) </details> ### 📄 Description # [tests] Add coverage tooling and pytest config ## Summary First PR of the test safety-net stage: before restructuring the code we need to see what the tests actually cover and make writing new ones cheap. This adds the tooling only - the missing test categories (cache, filters, golden files, e2e) come in follow-up PRs. ## Problem - No coverage tooling at all: we cannot tell which code a refactoring would break blind - No `[tool.pytest.ini_options]`: every async test carries a manual `@pytest.mark.asyncio`, and bare `pytest` stumbles over integration tests that need live credentials - The html renderer test writes `test_output.html` into the repo root - an interrupted run leaves garbage behind ## Fix - `pytest-cov` in dev deps + `task test:cov`: unit tests with a coverage report, uncovered lines listed (baseline today: 69% total, the post cache is the worst spot at 31-43%) - `asyncio_mode = "auto"`: async tests run under asyncio without a mark - 34 manual marks removed - `testpaths = ["test/unit"]`: bare `pytest` runs only unit tests; `task test:api` keeps working, its explicit path overrides testpaths - `-ra --strict-markers`: skip/xfail reasons show up in the summary, a typo in a mark fails instead of silently deactivating a test - The html test writes into pytest's `tmp_path` ## Verification - `task ci` green: lint, format, pyright, 129 unit tests, build - `task test:cov` produces the report (TOTAL 69%) - `pytest --collect-only test/integration` - all 6 integration tests still collect under auto mode (running them needs live credentials, not part of CI) ## Notes - No changelog entry: developer-facing tooling only, nothing changes for users (`ci/skip-changelog`) - The coverage threshold gate for CI comes in the last PR of this stage, set from the factual number once the new tests are in --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-13 19:48:08 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Glitchy-Sheep/boosty-downloader#159
No description provided.