Skip to content

Diff self-test hand-builds args as a SimpleNamespace, drifting from the CLI parser #105

Description

@asluk

The diff self-test constructs its args object by hand as a types.SimpleNamespace with a hardcoded field list (tests/build_scripts/build_diff.py:124), separate from the build subparser. Because it bypasses argparse, it does not inherit argparse's defaults — so every time a new build flag is added, it's absent on this object until someone remembers to add it manually.

This already bit us: the PDF quality-gate flags (--no-check-glyphs / --check-overflow / --overflow-threshold-pt, #100) were present on the CLI path but missing from this namespace, raising AttributeError: 'types.SimpleNamespace' object has no attribute 'no_check_glyphs' in the diff self-test. Worked around in #103 by reading the flags via getattr with shared default constants, but the underlying drift risk remains.

Suggestion: derive the diff-test args from the same build subparser instead of a hand-maintained namespace — e.g. parse_args([...]) a synthetic argv, or seed defaults via parser.get_default(...), then override only the diff-specific fields (diff, output, no_docx, etc.). New flags would then be picked up automatically and this whole class of break goes away.

Non-blocking / cleanup.

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