Skip to content

Package doctests never run in CI — 2 are broken and 1 hangs indefinitely #4

Description

@thorwhalen

Summary

ij's package doctests execute nowhere. [tool.pytest.ini_options] testpaths = ["tests"] wins over the run-tests-uv action's root-dir: ij input (which only feeds --cov=), and the action passes --doctest-modules with no path argument. So collection is scoped to tests/ and nothing under ij/ is ever doctested — locally or in CI — while CI reports green.

Fleet-level tracking of the mechanism: i2mint/wads#56.

What is actually broken behind that

Three distinct problems, all currently invisible:

  1. LLMConverter.refine doctest raises NameError: name 'converter' is not defined — the example references a name it never defines.
  2. ij/export/image.py doctest writes a real file into the repo root. It produced a stray diagram.png at the top level during investigation (removed). A doctest must not write into the working tree; it should use tmp_path/a temp dir, or be marked +SKIP.
  3. One doctest hangs indefinitely. pytest ij --doctest-modules never terminates. The hanging example has not been isolated — that is the first task here.

Suggested approach

  1. Find the hanger first, since it blocks everything else. Bisect with pytest ij --doctest-modules --collect-only to enumerate, then run modules one at a time with a timeout, e.g.:
    for m in ij/**/*.py; do timeout 30 python -m pytest "$m" --doctest-modules -q || echo "SLOW/FAIL: $m"; done
    Likely suspects are anything doing network I/O, subprocess rendering (mermaid/d2/plantuml CLI), or waiting on stdin.
  2. Fix (1) and (2), quarantine or fix (3).
  3. Only then widen testpaths to include the package dir (e.g. testpaths = ["ij", "tests"]), so CI genuinely runs them. Verify with python -m pytest --collect-only -q before/after — the item count must go up.
  4. Mirror the CI invocation when checking, because wads CI force-overrides doctest flags and drops NORMALIZE_WHITESPACE:
    python -m pytest --doctest-modules -o doctest_optionflags='ELLIPSIS IGNORE_EXCEPTION_DETAIL' -q

Why it matters

ij's parser had a severe silent-data-loss bug (see #3) that survived precisely because coverage was thin and one passing test masked it. Package doctests are the main remaining unexercised surface.

Surfaced during the 2026-07-30 wave-0 rollout batch.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions