Summary
sqlmesh test already takes multiple positional args, but they are test YAML paths only. Passing a model file looks that path up in the test-file index, matches nothing, and exits 0. A pre-commit hook that passes staged model files would silently run no tests.
--select-model takes names, not paths. tests= and model_names= are unioned, so you cannot pass a model file and a test YAML together and get both.
Current behavior
sqlmesh test tests/test_a.yaml runs that file
sqlmesh test models/a.sql runs zero tests and succeeds
sqlmesh test tests/test_b.yaml --select-model a runs only tests that are in that file and target model a
Proposed CLI
sqlmesh test --local models/a.sql tests/test_b.yaml
Each positional arg is either:
- a test YAML (or
file.yaml::test_name) → those tests, or
- a model file → unit tests for that model.
The two sets are a union. Staging models/a.sql and tests/test_b.yaml runs a’s tests and everything in b’s file.
Acceptance
- Model
.sql / .py paths select that model’s tests even if the YAML path did not change
- Test YAML paths still work
- Mixed args are unioned, not intersected
- A path that is neither a known model file nor a known test file errors (no silent pass)
--select-model name selectors keep current behavior
Summary
sqlmesh testalready takes multiple positional args, but they are test YAML paths only. Passing a model file looks that path up in the test-file index, matches nothing, and exits 0. A pre-commit hook that passes staged model files would silently run no tests.--select-modeltakes names, not paths. tests= and model_names= are unioned, so you cannot pass a model file and a test YAML together and get both.Current behavior
sqlmesh test tests/test_a.yamlruns that filesqlmesh test models/a.sqlruns zero tests and succeedssqlmesh test tests/test_b.yaml --select-model aruns only tests that are in that file and target model aProposed CLI
Each positional arg is either:
file.yaml::test_name) → those tests, orThe two sets are a union. Staging
models/a.sqlandtests/test_b.yamlruns a’s tests and everything in b’s file.Acceptance
.sql/.pypaths select that model’s tests even if the YAML path did not change--select-modelname selectors keep current behavior