Skip to content

test: improve coverage on critical paths (export, downloader, config) #119

Description

@nikazzio

Summary

The repo has no coverage gate in CI and no tracking of what critical paths lack tests. This issue tracks a targeted coverage push on the most important subsystems.

Areas to audit and cover

Area Current state Risk
services/export/service.py Some tests exist but one hangs (#117); custom page selection, remote-temp flow, multi-item ZIP need more edge cases High — user-facing export is a core flow
logic/downloader.py Instantiation tested via test_downloader_pdf_priority; actual download flow, resume, cancel paths lightly covered High — primary function of the app
logic/downloader_pdf.py create_pdf() tested indirectly; OCR JSON loading (recently fixed to load_json), cover page generation, quality settings need direct tests Medium
config_validation.py 4 tests; deprecated key warnings, whitelist prefix logic, nested schema validation could use more Medium — bad validation = silent config drift
http_client.py 42 tests — good coverage; get_http_client() singleton + reset_http_client() need a test Low — well tested
resolvers/discovery.py Per-provider search tested via unit mocks; manifest validation, probe retry, edge-case payloads need more Medium

Approach

  1. Run pytest --cov=src --cov-report=term-missing to get a baseline
  2. Identify uncovered critical branches (not just line coverage — focus on error paths and edge cases)
  3. Add targeted tests for the gaps above
  4. Consider adding a non-blocking coverage report to CI (ci: restore PR coverage for slow-marked networking and downloader tests #99)

Acceptance criteria

  • Coverage baseline documented
  • At least 80% line coverage on the 6 areas listed above
  • No new test should be marked slow unless it truly requires network/filesystem I/O
  • Coverage report added to CI as informational (non-blocking)

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions