test: add unit + subprocess tests for the gdb CLI#8
Merged
mohitgargai merged 1 commit intomainfrom Apr 24, 2026
Merged
Conversation
Covers the pure-function surface of `gdb.cli` and `gdb.suites` that had no regression safety net besides `gdb verify`. 42 tests, ~0.7s locally: - `test_suites.py` — `resolve_suite` routing for all four `v0-*` suites, partition invariants (understanding ∪ generation == all; ∩ == ∅), sorted / unique output, static-suite list safety, and error messages for unknown suites. - `test_cli_helpers.py` — `_parse_model_spec` (plain, aliased, whitespace, colon-in-entrypoint, invalid forms), `_parse_json_dict_arg` (None, empty, inline JSON, file path, type rejections), `_resolve_benchmark_ids` (suite vs explicit list, conflicting/missing args, unknown suite), and `_render_markdown_report` (empty results, full table, em-dash for missing metric per row, metadata presence, pipe-count consistency). - `test_cli_integration.py` — `python -m gdb` subprocess smokes for `--version`, `--help`, `list`, `suites`, `info <known>`, `info <unknown>`. Also: - Add `pytest>=7` to the `[dev]` extras so `pip install -e .[dev]` is the one-line setup for contributors. - CI: rename `test-import` → `test`, install `.[dev]`, extend `ruff check` to cover `tests/`, and run `pytest tests/ -v` on the existing 3.9 / 3.11 / 3.12 matrix. The registry-count sanity check and the legacy `scripts/run_benchmarks.py --list` smoke are preserved. Made-with: Cursor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the first test suite for this repo. 42 tests, ~0.7s locally, covering the pure-function surface of
gdb.cliandgdb.suitesthat previously had no regression safety net beyondgdb verifyas a de-facto integration test.This was raised as a follow-up in #7 and is a precondition for refactoring any of the CLI glue code with confidence.
Changes
tests/test_suites.pyresolve_suiterouting for all fourv0-*suites.v0-understanding ∪ v0-generation == v0-all, and∩ == ∅.tests/test_cli_helpers.py_parse_model_spec: plain, aliased, whitespace-tolerant, colon-in-entrypoint (custom provider), missing-colon / unknown-provider errors._parse_json_dict_arg: None, empty / whitespace, inline JSON, on-disk JSON file viatmp_path, non-dict JSON and wrong-type rejections._resolve_benchmark_ids: suite path, explicit list, both-given, neither-given, unknown suite._render_markdown_report: empty results render, full table with metric columns, em-dash for rows missing a metric, metadata section presence, pipe-count consistency.tests/test_cli_integration.pypython -m gdb --versionprintslica-gdb <version>.python -m gdb --helplists core subcommands.python -m gdb listshows39 benchmark(s).python -m gdb suitesshows all fourv0-*suites.python -m gdb info <known|unknown>exits 0 / non-zero appropriately.Tooling
pytest>=7to the[dev]extras, sopip install -e .[dev]is the contributor one-liner.test-import→test, install.[dev], extendruff checkto covertests/, runpytest tests/ -von the existing 3.9 / 3.11 / 3.12 matrix. The registry-count sanity check and the legacyscripts/run_benchmarks.py --listsmoke are preserved.Testing
pytest tests/ -v— 42 passed in 0.74s on Python 3.12 locallyruff check src/ scripts/ tests/— cleanKnown follow-ups (not in this PR)
gdb evalwith real providers) are intentionally out of scope — they require API keys and belong in an out-of-band smoke, not in CI.gdb submit/gdb collectmanifest handling is not yet tested; deferred until the multi-task submit work lands.Made with Cursor