Skip to content

Commit

Permalink
Add functional tests for unit testing an incremental model with a ver…
Browse files Browse the repository at this point in the history
…sion
  • Loading branch information
dbeatty10 committed Sep 23, 2024
1 parent f4e46a7 commit 79d650b
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/functional/unit_testing/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,14 @@
{% endif %}
"""

my_incremental_model_versioned_yml = """
models:
- name: my_incremental_model
latest_version: 1
versions:
- v: 1
"""

test_my_model_incremental_yml_basic = """
unit_tests:
- name: incremental_false
Expand Down
19 changes: 19 additions & 0 deletions tests/functional/unit_testing/test_unit_testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
external_package,
external_package__accounts_seed_csv,
my_incremental_model_sql,
my_incremental_model_versioned_yml,
my_incremental_model_with_alias_sql,
my_model_a_sql,
my_model_b_sql,
Expand Down Expand Up @@ -290,6 +291,24 @@ def test_basic(self, project):
assert len(results) == 2


class TestUnitTestIncrementalModelWithVersion:
@pytest.fixture(scope="class")
def models(self):
return {
"my_incremental_model.sql": my_incremental_model_sql,
"events.sql": event_sql,
"schema.yml": my_incremental_model_versioned_yml + test_my_model_incremental_yml_basic,
}

def test_basic(self, project):
results = run_dbt(["run"])
assert len(results) == 2

# Select by model name
results = run_dbt(["test", "--select", "my_incremental_model"], expect_pass=True)
assert len(results) == 2


class TestUnitTestExplicitSeed:
@pytest.fixture(scope="class")
def seeds(self):
Expand Down

0 comments on commit 79d650b

Please sign in to comment.