-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
convert to use unit test name at top level key #8966
Conversation
Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see the contributing guide. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## unit_testing_feature_branch #8966 +/- ##
===============================================================
- Coverage 86.63% 86.63% -0.01%
===============================================================
Files 181 181
Lines 26979 26970 -9
===============================================================
- Hits 23374 23365 -9
Misses 3605 3605
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
97ee053
to
1d3d86f
Compare
) | ||
self.manifest.add_unit_test(self.yaml.file, unit_test_definition) | ||
unit_test_case_unique_id = ( | ||
f"{NodeType.Unit}.{self.project.project_name}.{unit_test.model}.{unit_test.name}" |
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.
Is there a reason we were hard coding unit
here? It doesn't match how we assign the unique ids for other node types.
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.
I don't think there's an explicit reason. What would be a more conventional way to build the unique_id here?
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.
Using {NodeType.Unit}
instead of a hardcoded unit
is more conventional. I went ahead and made the change because it didn't seem intentional but wanted to check in case.
546abdd
to
a508ee8
Compare
core/dbt/parser/partial.py
Outdated
@@ -711,7 +711,6 @@ def _handle_element_change( | |||
# Take a "section" of the schema file yaml dictionary from saved and new schema files | |||
# and determine which parts have changed | |||
def get_diff_for(self, key, saved_yaml_dict, new_yaml_dict): | |||
dict_name = "model" if key == "unit" else "name" |
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.
✨
* Initial implementation of unit testing (from pr #2911) Co-authored-by: Michelle Ark <michelle.ark@dbtlabs.com> * 8295 unit testing artifacts (#8477) * unit test config: tags & meta (#8565) * Add additional functional test for unit testing selection, artifacts, etc (#8639) * Enable inline csv format in unit testing (#8743) * Support unit testing incremental models (#8891) * update unit test key: unit -> unit-tests (#8988) * convert to use unit test name at top level key (#8966) * csv file fixtures (#9044) * Unit test support for `state:modified` and `--defer` (#9032) Co-authored-by: Michelle Ark <michelle.ark@dbtlabs.com> * Allow use of sources as unit testing inputs (#9059) * Use daff for diff formatting in unit testing (#8984) * Fix #8652: Use seed file from disk for unit testing if rows not specified in YAML config (#9064) Co-authored-by: Michelle Ark <MichelleArk@users.noreply.github.com> Fix #8652: Use seed value if rows not specified * Move unit testing to test and build commands (#9108) * Enable unit testing in non-root packages (#9184) * convert test to data_test (#9201) * Make fixtures files full-fledged members of manifest and enable partial parsing (#9225) * In build command run unit tests before models (#9273) --------- Co-authored-by: Michelle Ark <michelle.ark@dbtlabs.com> Co-authored-by: Michelle Ark <MichelleArk@users.noreply.github.com> Co-authored-by: Emily Rockman <emily.rockman@dbtlabs.com> Co-authored-by: Jeremy Cohen <jeremy@dbtlabs.com> Co-authored-by: Kshitij Aranke <kshitij.aranke@dbtlabs.com>
resolves #8698
unit
tounit-tests
will be a separate PRProblem
Uses test name instead of model as top level key, resulting in the removal of test suites under a single key.
Solution
Checklist