PR #35 added two new CLI subcommands and a sql_guard/snapshot.py module for SQLAlchemy introspection. Codecov flagged the patch at 63.95% because the new code is uncovered:
sql_guard/snapshot.py — 0% (66 lines). Needs a fixture engine (sqlite in-memory works for the introspection paths) or a mocked SQLAlchemy inspector.
sql_guard/cli.py — 0% on the new schema-snapshot and validate-contract handlers. Both can be exercised with typer.testing.CliRunner.
Suggested coverage
tests/test_validate_contract_cli.py — call validate-contract against tests/fixtures/contract_sample.yml and assert exit code 0 plus the printed table/column counts. Then call it against a malformed YAML and assert non-zero exit.
tests/test_snapshot.py — build a small sqlite schema in a tmp DB, run snapshot.introspect(), and assert the dataclass shape matches the contract format.
tests/test_schema_snapshot_cli.py — same sqlite engine, exercised through CliRunner so the --dsn / --output / --schema / --include-table flag plumbing is covered too.
Bumps patch coverage on the contracts area to ~95%+
PR #35 added two new CLI subcommands and a
sql_guard/snapshot.pymodule for SQLAlchemy introspection. Codecov flagged the patch at 63.95% because the new code is uncovered:sql_guard/snapshot.py— 0% (66 lines). Needs a fixture engine (sqlite in-memory works for the introspection paths) or a mocked SQLAlchemy inspector.sql_guard/cli.py— 0% on the newschema-snapshotandvalidate-contracthandlers. Both can be exercised withtyper.testing.CliRunner.Suggested coverage
tests/test_validate_contract_cli.py— callvalidate-contractagainsttests/fixtures/contract_sample.ymland assert exit code 0 plus the printed table/column counts. Then call it against a malformed YAML and assert non-zero exit.tests/test_snapshot.py— build a small sqlite schema in a tmp DB, runsnapshot.introspect(), and assert the dataclass shape matches the contract format.tests/test_schema_snapshot_cli.py— same sqlite engine, exercised throughCliRunnerso the--dsn / --output / --schema / --include-tableflag plumbing is covered too.Bumps patch coverage on the contracts area to ~95%+