From c275dcb2e7a669edd4329943e9904957bdfde949 Mon Sep 17 00:00:00 2001 From: DevForge Engineer Date: Mon, 18 May 2026 16:07:12 -0400 Subject: [PATCH 1/2] fix(ci): extend ruff lint to tests/ and fix 3 lint errors in test_cli.py --- .github/workflows/ci.yml | 2 +- tests/test_cli.py | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3bc72c2..a1f8cd0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,7 +32,7 @@ jobs: pip install -e ".[dev]" - name: Lint with ruff - run: pip install ruff && ruff check src/ --target-version py310 + run: pip install ruff && ruff check src/ tests/ --target-version py310 - name: Run tests run: | python -m pytest tests/ -v --cov=schemaforge --cov-report=term-missing diff --git a/tests/test_cli.py b/tests/test_cli.py index 67776e2..3b7ade5 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -7,10 +7,8 @@ import sys import tempfile -from pathlib import Path - -import pytest from click.testing import CliRunner +from pathlib import Path sys.path.insert(0, str(Path(__file__).parent.parent / "src")) @@ -370,7 +368,7 @@ def test_check_directory_with_type_map(self): Path(tmpdir, "schema.sql").write_text(SAMPLE_SQL) Path(tmpdir, "schema.prisma").write_text(SAMPLE_PRISMA) - result = runner.invoke(main, [ + runner.invoke(main, [ "check", "--dir", tmpdir, "--type-map", str(type_map), From 875fda4ebd4c3227831e5e4974278166e24a5d28 Mon Sep 17 00:00:00 2001 From: DevForge Engineer Date: Mon, 18 May 2026 18:22:20 -0400 Subject: [PATCH 2/2] fix(cli): pass version explicitly to @click.version_option @click.version_option() with no arguments auto-detects version from installed package metadata. This fails in CI because the distribution name (schemaforge-cli) differs from the module name (schemaforge), causing Click's CliRunner to raise RuntimeError. Pass __version__ explicitly from the package to bypass auto-detection. Fixes test_version CI failure across all Python versions (3.10-3.13). --- src/schemaforge/cli.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/schemaforge/cli.py b/src/schemaforge/cli.py index b743107..d54639e 100644 --- a/src/schemaforge/cli.py +++ b/src/schemaforge/cli.py @@ -13,6 +13,7 @@ def decorator(func): return func return decorator +from . import __version__ from .check import check_directory from .convert import convert_schema from .diff import diff_schemas @@ -27,7 +28,7 @@ def decorator(func): @click.group() -@click.version_option() +@click.version_option(version=__version__) def main() -> None: """SchemaForge — bidirectional ORM schema converter.