Repository navigation
fix: require a TEST() header in SQL test files again - #1000
Merged
Merged
Conversation
A SQL test file must again start with a TEST() header; a file without one fails discovery with D003. Mode inference and the optional trailing SELECT 1 are unchanged. Docs, the skill and the example tests show the header again.
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.
Why
#978 made three parts of a SQL test file optional. The optional
TEST()header is being reverted: every test file should again start with aTEST()header so test files are unambiguous to read, lint and format. Mode inference and the optional trailingSELECT 1from #978 stay.Changes
TEST()header fails with D003 again ("must start with a TEST() header as the first non-whitespace content"). The header-less parse path is removed; mode inference from__macro_actual__,__udf_actual__and__table_fn_actual__is kept for headers withoutmode.tests/unitare no longer treated as tests without a header (LintFileRole.in_sql_test_directoryremoved). OmittedSELECT 1handling for TEST and SCENARIO bodies is unchanged.TEST();and still omitSELECT 1; a new E2E case checks a header-less test file is rejected with D003.TEST();restored. Docs state that every test file starts with aTEST()header (fields optional; an unnamed test is named after its file), the mode is inferred, and the trailingSELECT 1is optional. Skill references regenerated.Verification
uv run pyteston discoverytest_sql_tests.py, linttest_run_lint.py, compile helpertest_tests.pyandtest_scenarios.py, and E2Etest_optional_test_ceremony.py(182 passed)ruff check,ruff format --check,uv run fensu checkmake check-ci