-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix unit tests for incremental models with alias #10755
Merged
MichelleArk
merged 4 commits into
dbt-labs:main
from
katsugeneration:fix-unit-incremental-alias
Sep 24, 2024
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
67726a7
Fix unittest incremental model with alias
katsugeneration 4ce3aa7
Add changie changelog
katsugeneration f4e46a7
Change issue referrence
katsugeneration 79d650b
Add functional tests for unit testing an incremental model with a ver…
dbeatty10 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
kind: Fixes | ||
body: Fix unit tests for incremental model with alias | ||
time: 2024-09-22T13:35:27.991398741Z | ||
custom: | ||
Author: katsugeneration | ||
Issue: "10754" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ | |
external_package, | ||
external_package__accounts_seed_csv, | ||
my_incremental_model_sql, | ||
my_incremental_model_with_alias_sql, | ||
my_model_a_sql, | ||
my_model_b_sql, | ||
my_model_sql, | ||
|
@@ -271,6 +272,24 @@ def test_no_this_input(self, project): | |
""" | ||
|
||
|
||
class TestUnitTestIncrementalModelWithAlias: | ||
@pytest.fixture(scope="class") | ||
def models(self): | ||
return { | ||
"my_incremental_model.sql": my_incremental_model_with_alias_sql, | ||
"events.sql": event_sql, | ||
"schema.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 | ||
Comment on lines
+276
to
+291
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This tests the regression reported in #10754. I confirmed this test fails without the fix but succeeds with the fix in place: python -m pytest tests/functional/unit_testing/test_unit_testing.py::TestUnitTestIncrementalModelWithAlias |
||
|
||
|
||
class TestUnitTestExplicitSeed: | ||
@pytest.fixture(scope="class") | ||
def seeds(self): | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The root causes of the regressions reported in #10754 and #10763 was that:
this_node.name
tothis_node.identifier
was accidentally overlooked during the implementation and code review of https://github.com/dbt-labs/dbt-core/pull/10290/files, andThis PR addresses both of those root causes ✅ ✅