Skip to content

No behavioural test coverage: the only doctest is +SKIP #1

Description

@thorwhalen

What

wads.repo_audit flags replize as having no test files. That is accurate in
practice, not just formally:

  • there is no tests/ directory and no in-package tests/;

  • the only doctest in the package (replize/__init__.py) is

    >>> from replize import replize
    >>> replize("ls")  # doctest: +SKIP
    

    The second line is skipped (it would block on input() forever), so CI's
    pytest --doctest-modules verifies exactly one thing: that the package
    imports.

So replize() itself — prompt formatting, exit-command handling,
subprocess dispatch, stdout/stderr callbacks, exit_exceptions handling — has
zero automated coverage, and _replize_cli (the replize console script,
the package's main user-facing surface) has none either.

Why it matters

The function is small but has several branches that are easy to regress
silently, and it is exposed as an installed console script. A packaging or
Python-version change could break the CLI without CI noticing.

Suggested fix

The design is already test-friendly — replize() takes stdout_callback /
stderr_callback as injectable arguments, and reads input through input().
A tests/test_replize.py could:

  1. monkeypatch builtins.input with a scripted sequence of lines
    (e.g. ["-l", "exit"]) and collect output through capture callbacks, then
    assert on what the callbacks received and that the loop terminated;
  2. assert that an exit command in exit_commands breaks the loop, and that an
    exception listed in exit_exceptions (e.g. EOFError raised by the patched
    input) also breaks it rather than propagating;
  3. assert the prompt string is rendered from prompt_template;
  4. cover _replize_cli argument parsing by patching replize and calling the
    entry point with a crafted sys.argv.

Using a portable command (python -c ... rather than ls) keeps it green on
the Windows leg of CI.

Notes

Raised while migrating this repo to pyproject.toml + the wads uv CI stub; the
migration pass deliberately did not add tests. Related config detail: CI
collection is driven by testpaths, now ["replize"]. If a top-level tests/
directory is added, extend testpaths to ["replize", "tests"] or the new
tests will not be collected by CI.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions