Skip to content
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

Rename tests -> data_tests for model-level + versions #9412

Merged
merged 3 commits into from
Jan 22, 2024
Merged

Conversation

jtcohen6
Copy link
Contributor

@jtcohen6 jtcohen6 commented Jan 19, 2024

resolves #9411

Problem

We now expect data tests to be defined in blocks named data_tests. For back compat, we need to support tests (previous name). To that end, we've added logic for validation (can't have both) and renaming (old → new).

However, this is not working for tests defined at the model-level, and tests defined on specific versions of a versioned model.

Solution

Generalize the validation/renaming logic, and apply it everywhere that a tests block can be defined.

Checklist

  • I have read the contributing guide and understand what's expected of me
  • I have run this code in development and it appears to resolve the stated issue
  • This PR includes tests, or tests are not required/relevant for this PR
  • This PR has no interface changes (e.g. macros, cli, logs, json artifacts, config files, adapter interface, etc) or this PR has already received feedback and approval from Product or DX
  • This PR includes type annotations for new and modified functions

@cla-bot cla-bot bot added the cla:yes label Jan 19, 2024
Copy link
Contributor

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.

Copy link

codecov bot commented Jan 19, 2024

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (dc47f6b) 86.96% compared to head (26e7512) 86.93%.
Report is 1 commits behind head on main.

Files Patch % Lines
core/dbt/contracts/graph/nodes.py 87.50% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9412      +/-   ##
==========================================
- Coverage   86.96%   86.93%   -0.04%     
==========================================
  Files         187      187              
  Lines       24947    24972      +25     
==========================================
+ Hits        21695    21709      +14     
- Misses       3252     3263      +11     
Flag Coverage Δ
integration 84.31% <96.15%> (-0.03%) ⬇️
unit 63.25% <65.38%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jtcohen6 jtcohen6 marked this pull request as ready for review January 19, 2024 20:53
@jtcohen6 jtcohen6 requested a review from a team as a code owner January 19, 2024 20:53
@jtcohen6
Copy link
Contributor Author

Sort of funny how the three tests in tests/functional/deprecations ended up in the same subfolder:

  • model_deprecations is testing the dbt feature whereby users can slate models for deprecation (docs)
  • test_config_deprecations is testing the deprecation, validation, and rename of the "test config" from testsdata_tests (given the advent of unit_tests)
  • test_deprecations is a [functional] test for all our other deprecations

@MichelleArk MichelleArk requested review from MichelleArk and removed request for martynydbt January 22, 2024 14:33
@jtcohen6 jtcohen6 merged commit 2a5ad17 into main Jan 22, 2024
51 checks passed
@jtcohen6 jtcohen6 deleted the jerco/fix-9411 branch January 22, 2024 20:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CT-3570] [Bug] tests -> data_tests rename misses model-level tests + tests defined on model versions
2 participants