Skip to content

[Testing]: Differential tests — _grep_python vs system grep #63

Description

@shauryagangrade

Problem

GCode ships a pure-Python grep fallback (_grep_python) for Windows, but it
is only compared against expected strings, not against a real grep on the
same corpus. Discrepancies in matching (regex flavor, --glob, case
insensitivity, binary detection) go unnoticed.

Proposed approach

  • Build a fixture corpus (text, nested dirs, binary file, files matching/not
    matching a glob).
  • On platforms with grep, assert _grep_python(...) and grep -r ...
    produce equivalent matches for: plain regex, -i, glob filter, no-match.
  • Keep tests skippable when grep isn't available.

Where to look

  • gcode/tools.py:242-285 (_grep_python), :192-229 (grep tool)
  • Existing tests/test_tools.py grep tests.

Acceptance criteria

  • New tests/test_grep_differential.py passes on macOS/Linux, skips cleanly on Windows.

Difficulty

Low — good first issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueGood for newcomerstestingTests and test infrastructure

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions