Skip to content

Commit

Permalink
Add check-substrait-extensions to pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
scgkiran committed Sep 12, 2024
1 parent 5a36340 commit 0f672bc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
8 changes: 8 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,11 @@ repos:
rev: 6.1.0
hooks:
- id: flake8
- repo: local
hooks:
- id: check-substrait-extensions
name: Check Substrait extensions
entry: pytest tests/test_extensions.py::test_read_substrait_extensions
language: python
pass_filenames: false

7 changes: 6 additions & 1 deletion tests/test_extensions.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
# SPDX-License-Identifier: Apache-2.0
import os

from tests.coverage.extensions import build_type_to_short_type


# NOTE: this test is run as part of pre-commit hook
def test_read_substrait_extensions():
from tests.coverage.extensions import Extension

registry = Extension.read_substrait_extensions("../extensions")
current_dir = os.path.dirname(os.path.abspath(__file__))
extensions_path = os.path.join(current_dir, "../extensions")
registry = Extension.read_substrait_extensions(extensions_path)
assert len(registry.registry) >= 161
num_overloads = sum([len(f) for f in registry.registry.values()])
assert num_overloads >= 510
Expand Down

0 comments on commit 0f672bc

Please sign in to comment.