You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 11ed15d
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -65,10 +65,12 @@ See [docs/development.md](docs/development.md) for full setup instructions. Key
65
65
python -m venv .venv
66
66
source .venv/bin/activate
67
67
make install-dev
68
-
make style # Run before submitting
68
+
make style # Run before submitting
69
69
make fast-test # Quick test suite
70
70
```
71
71
72
+
Optionally, `make install-pre-commit` installs git hooks so ruff and mypy run on `git commit`. Hooks do not replace `make style`: they run on staged files, while CI runs `make style` across the tree.
73
+
72
74
## Coding Standards
73
75
74
76
- Run `make style` before submitting a pull request
pytest -n auto -m "fast and not cicdonly and not isolated" --junitxml=test-results/junit-fast-test.xml && pytest -m "isolated and not slow"&& pytest -m "registry_isolation"&& pytest -m "dialect_isolated"
135
+
pytest -n auto -m "fast and not cicdonly and not isolated" --junitxml=test-results/junit-fast-test.xml && pytest -m "isolated and not slow and not fork_isolated"&& pytest tests/test_forking.py::test_parallel_load -m "isolated and fork_isolated and not slow"&& pytest tests/test_forking.py::test_parallel_load_multi_repo -m "isolated and fork_isolated and not slow"&& pytest -m "registry_isolation"&& pytest -m "dialect_isolated"
136
136
137
137
slow-test:
138
-
pytest -n auto -m "(fast or slow) and not cicdonly and not isolated"&& pytest -m "isolated"&& pytest -m "registry_isolation"&& pytest -m "dialect_isolated"
138
+
pytest -n auto -m "(fast or slow) and not cicdonly and not isolated"&& pytest -m "isolated and not fork_isolated"&& pytest tests/test_forking.py::test_parallel_load -m "isolated and fork_isolated"&& pytest tests/test_forking.py::test_parallel_load_multi_repo -m "isolated and fork_isolated"&& pytest -m "registry_isolation"&& pytest -m "dialect_isolated"
139
139
140
140
cicd-test:
141
-
pytest -n auto -m "(fast or slow) and not pyspark and not isolated" --junitxml=test-results/junit-cicd.xml && pytest -m "pyspark"&& pytest -m "isolated and not pyspark"&& pytest -m "registry_isolation"&& pytest -m "dialect_isolated"
141
+
pytest -n auto -m "(fast or slow) and not pyspark and not isolated" --junitxml=test-results/junit-cicd.xml && pytest -m "pyspark"&& pytest -m "isolated and not pyspark and not fork_isolated"&& pytest tests/test_forking.py::test_parallel_load -m "isolated and not pyspark and fork_isolated"&& pytest tests/test_forking.py::test_parallel_load_multi_repo -m "isolated and not pyspark and fork_isolated"&& pytest -m "registry_isolation"&& pytest -m "dialect_isolated"
142
142
143
143
core-fast-test:
144
144
pytest -n auto -m "fast and not web and not github and not dbt and not jupyter"
Copy file name to clipboardExpand all lines: docs/concepts/tests.md
+31Lines changed: 31 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -463,6 +463,37 @@ You can also run tests that match a pattern or substring using a glob pathname e
463
463
$ sqlmesh test tests/test_*
464
464
```
465
465
466
+
Passing the path of a model file runs the tests for that model, which is useful for commit hooks and other tools that work with changed files rather than test names:
467
+
468
+
```
469
+
$ sqlmesh test models/full_model.sql
470
+
```
471
+
472
+
Model files and test files can be mixed, and the results are unioned. A test selected by more than one argument still runs only once, so the following runs each of `full_model`'s tests a single time even though both arguments cover them:
473
+
474
+
```
475
+
$ sqlmesh test models/full_model.sql tests/test_full_model.yaml
476
+
```
477
+
478
+
An argument that is neither a known model file nor a known test file is an error, so a mistyped or stale path fails instead of quietly running no tests. A model that simply has no tests is not an error.
479
+
480
+
You can pass `--local` to run tests without loading state from the configured state connection:
481
+
482
+
```bash
483
+
$ sqlmesh test --local
484
+
```
485
+
486
+
This keeps offline runs and commit hooks from opening a connection to the state backend.
487
+
488
+
In multi-repository setups, or when running tests for only a subset of projects, models that exist only in remote state are not loaded under `--local`. Unlike [`sqlmesh lint --local`](../guides/linter.md), which reports additional errors in that situation, a test whose model is missing is **skipped with a warning and the run still succeeds**:
489
+
490
+
```
491
+
[WARNING] Model '"memory"."bronze"."a"' was not found at tests/test_a.yaml
492
+
.**Successfully Ran `1` Tests Against `duckdb`**
493
+
```
494
+
495
+
So a passing exit code alone does not mean every test you expected actually ran. Watch the output for these warnings, and keep in mind that a hook using `--local` will not fail on them.
496
+
466
497
### Testing using notebooks
467
498
468
499
You can execute tests on demand using the `%run_test` notebook magic as follows:
Copy file name to clipboardExpand all lines: docs/development.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -42,7 +42,7 @@ Once you have activated your virtual environment, you can install the dependenci
42
42
make install-dev
43
43
```
44
44
45
-
Optionally, you can use pre-commit to automatically run linters/formatters:
45
+
Optionally, `make install-pre-commit` installs git hooks so ruff and mypy run on `git commit`. Hooks do not replace `make style`: they run on staged files, while CI runs `make style` across the tree.
0 commit comments