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
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
Copy file name to clipboardExpand all lines: docs/concepts/tests.md
+17Lines changed: 17 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -463,6 +463,23 @@ 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
+
You can pass `--local` to run tests without loading state from the configured state connection:
467
+
468
+
```bash
469
+
$ sqlmesh test --local
470
+
```
471
+
472
+
This keeps offline runs and commit hooks from opening a connection to the state backend.
473
+
474
+
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**:
475
+
476
+
```
477
+
[WARNING] Model '"memory"."bronze"."a"' was not found at tests/test_a.yaml
478
+
.**Successfully Ran `1` Tests Against `duckdb`**
479
+
```
480
+
481
+
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.
482
+
466
483
### Testing using notebooks
467
484
468
485
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.
# The parent callback constructs Context before Click invokes the subcommand, so inspect its
135
+
# parsed args here.
136
+
if (
137
+
ctx.invoked_subcommandinOPTIONAL_LOCAL_COMMANDS
138
+
and"--local"inctx.meta["subcommand_args"]
139
+
):
134
140
load_state=False
135
141
136
142
iflen(paths) ==1:
@@ -811,6 +817,12 @@ def create_test(
811
817
multiple=True,
812
818
help="Select specific models to run unit tests for.",
813
819
)
820
+
@click.option(
821
+
"--local",
822
+
is_flag=True,
823
+
expose_value=False,
824
+
help="Run tests using only locally loaded project files without loading state. Tests whose model is not loaded are skipped with a warning rather than failing.",
0 commit comments