Skip to content

Commit

Permalink
✅ Add test to check that expresion.py is in sync with Jinja2
Browse files Browse the repository at this point in the history
  • Loading branch information
tiangolo committed Aug 29, 2022
1 parent de1547c commit 08b8ac8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions scripts/generate_select.py
@@ -1,3 +1,4 @@
import os
from itertools import product
from pathlib import Path
from typing import List, Tuple
Expand Down Expand Up @@ -52,4 +53,11 @@ class Arg(BaseModel):

result = black.format_str(result, mode=black.Mode())

current_content = destiny_path.read_text()

if current_content != result and os.getenv("CHECK_JINJA"):
raise RuntimeError(
"sqlmodel/sql/expression.py content not update with Jinja2 template"
)

destiny_path.write_text(result)
1 change: 1 addition & 0 deletions scripts/test.sh
Expand Up @@ -3,6 +3,7 @@
set -e
set -x

CHECK_JINJA=1 python scripts/generate_select.py
coverage run -m pytest tests
coverage combine
coverage report --show-missing
Expand Down

0 comments on commit 08b8ac8

Please sign in to comment.