Skip to content

Commit cbe9fc6

Browse files
committed
feature: removing dry-run behavior, will just run incremental tests now too
Signed-off-by: Cortland Goffena <30168413+cmgoffena13@users.noreply.github.com>
1 parent 9e6bf5d commit cbe9fc6

10 files changed

Lines changed: 7 additions & 46 deletions

File tree

docs/concepts/overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Bad data is worse than no data. The best way to keep bad data out of your system
5252
### [Tests](./tests.md)
5353
SQLMesh "tests" are similar to unit tests in software development, where the unit is a single model. SQLMesh tests validate model *code* &mdash; you specify the input data and expected output, then SQLMesh runs the test and compares the expected and actual output.
5454

55-
SQLMesh automatically runs tests for models included in a `plan` (added, modified, or restated). Plans with no such models, and `--skip-backfill` / `--dry-run` plans, skip unit tests by default. Use `--all-tests` for the full suite, `--skip-tests` to skip, or run tests on demand with the [`test` command](../reference/cli.md#test).
55+
SQLMesh automatically runs tests for models included in a `plan` (added, modified, or restated). Plans with no such models skip unit tests by default. Use `--all-tests` for the full suite, `--skip-tests` to skip, or run tests on demand with the [`test` command](../reference/cli.md#test).
5656

5757
Learn more in the [testing guide](../guides/testing.md).
5858

docs/concepts/tests.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@ Testing allows you to protect your project from regression by continuously verif
44

55
By default, `sqlmesh plan` runs unit tests only for models included in the plan (added, modified, or restated). Plans with no such models skip unit tests. Use `--all-tests` to run the full suite, or `--skip-tests` to run none.
66

7-
!!! important
8-
9-
`--skip-backfill` / `--dry-run` plans skip unit tests by default. Pass `--all-tests` if you still want the full suite to run.
10-
117
Similar to unit testing in software development, SQLMesh evaluates the model's logic against predefined inputs and then compares the output to expected outcomes provided as part of each test.
128

139
A comprehensive suite of tests can empower data practitioners to work with confidence, as it allows them to ensure models behave as expected after changes have been applied to them.

docs/guides/models.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,6 @@ Reverting to a previous model version is a quick operation since no additional w
162162
SQLMesh automatically validates your models in order to ensure the quality and accuracy of your data. This is done via the following:
163163
164164
* Running unit tests for models in the plan when you execute the `plan` command (use `--all-tests` for the full suite, or `--skip-tests` to skip). This ensures changes applied to any environment are logically validated. Refer to [testing](../concepts/tests.md) for more information.
165-
166-
!!! important
167-
168-
`--skip-backfill` / `--dry-run` plans skip unit tests by default. Pass `--all-tests` if you still want tests to run.
169165
* Running audits whenever data is loaded to a table (either for backfill or loading on a cadence). This way you know all data present in any table has passed all defined audits. Refer to [auditing](../concepts/audits.md) for more information.
170166
171167
SQLMesh also provides automatic validation via CI/CD by automatically creating a preview environment.

docs/guides/testing.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ As the unit tests run, SQLMesh will identify any that fail.
1414

1515
By default, `sqlmesh plan` runs unit tests only for models included in the plan (added, modified, or restated). Plans with no such models skip unit tests. Use `--all-tests` to run the full suite, or `--skip-tests` to run none.
1616

17-
!!! important
18-
19-
`--skip-backfill` / `--dry-run` plans skip unit tests by default. Pass `--all-tests` if you still want the full suite to run.
20-
2117
For more information about tests, refer to [testing](../concepts/tests.md).
2218

2319
### Test changes to a specific model

docs/reference/cli.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,8 +373,7 @@ Options:
373373
when comparing to existing snapshots for
374374
matching models in the target environment.
375375
--skip-backfill, --dry-run Skip the backfill step and only create a
376-
virtual update for the plan. Unit tests are
377-
also skipped unless --all-tests is passed.
376+
virtual update for the plan.
378377
--empty-backfill Produce empty backfill. Like --skip-backfill
379378
no models will be backfilled, unlike --skip-
380379
backfill missing intervals will be recorded

docs/reference/notebook.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,7 @@ options:
134134
the target environment.
135135
--skip-backfill, --dry-run
136136
Skip the backfill step and only create a virtual
137-
update for the plan. Unit tests are also skipped
138-
unless --all-tests is passed.
137+
update for the plan.
139138
--forward-only Create a plan for forward-only changes.
140139
--effective-from EFFECTIVE_FROM
141140
The effective date from which to apply forward-only

sqlmesh/cli/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ def diff(ctx: click.Context, environment: t.Optional[str] = None) -> None:
452452
"--skip-backfill",
453453
"--dry-run",
454454
is_flag=True,
455-
help="Skip the backfill step and only create a virtual update for the plan. Unit tests are also skipped unless --all-tests is passed.",
455+
help="Skip the backfill step and only create a virtual update for the plan.",
456456
default=None,
457457
)
458458
@click.option(

sqlmesh/core/context.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1606,10 +1606,6 @@ def plan_builder(
16061606
skip_linter = skip_linter or False
16071607
min_intervals = min_intervals or 0
16081608

1609-
# Virtual-only plans (--skip-backfill / --dry-run) skip unit tests unless --all-tests.
1610-
if skip_backfill and not all_tests:
1611-
skip_tests = True
1612-
16131609
environment = environment or self.config.default_target_environment
16141610
environment = Environment.sanitize_name(environment)
16151611
is_dev = environment != c.PROD

sqlmesh/magics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ def test(self, context: Context, line: str, test_def_raw: t.Optional[str] = None
434434
"--skip-backfill",
435435
"--dry-run",
436436
action="store_true",
437-
help="Skip the backfill step and only create a virtual update for the plan. Unit tests are also skipped unless --all-tests is passed.",
437+
help="Skip the backfill step and only create a virtual update for the plan.",
438438
)
439439
@argument(
440440
"--empty-backfill",

tests/cli/test_cli.py

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -274,27 +274,6 @@ def test_plan_runs_only_changed_model_tests(runner, tmp_path):
274274
assert "Successfully Ran 2 tests against duckdb" in result.output
275275

276276

277-
def test_plan_skip_backfill_all_tests(runner, tmp_path):
278-
create_example_project(tmp_path)
279-
280-
result = runner.invoke(
281-
cli,
282-
[
283-
"--log-file-dir",
284-
tmp_path,
285-
"--paths",
286-
tmp_path,
287-
"plan",
288-
"--skip-backfill",
289-
"--no-gaps",
290-
"--all-tests",
291-
],
292-
input="y\n",
293-
)
294-
assert result.exit_code == 0
295-
assert "Successfully Ran 1 tests against duckdb" in result.output
296-
297-
298277
def test_plan_skip_linter(runner, tmp_path):
299278
create_example_project(tmp_path)
300279

@@ -363,8 +342,8 @@ def test_plan_skip_backfill(runner, tmp_path, flag):
363342
assert result.exit_code == 0
364343
assert_virtual_layer_updated(result)
365344
assert "Model batches executed" not in result.output
366-
# --skip-backfill / --dry-run skips unit tests by default
367-
assert "Successfully Ran" not in result.output
345+
# Dry-run still runs plan-scoped unit tests
346+
assert "Successfully Ran 1 tests against duckdb" in result.output
368347

369348

370349
def test_plan_min_intervals(runner, tmp_path):

0 commit comments

Comments
 (0)