dbt-labs / dbt-core

dbt enables data analysts and engineers to transform their data using the same practices that software engineers use to build applications.
https://getdbt.com
Apache License 2.0
9.96k stars 1.63k forks source link

Support disabling unit tests #10831

Closed tsturge closed 1 week ago

tsturge commented 1 month ago

Support config: disabled for unit tests. (#9109)

Also, when a model is disabled, disable the corresponding unit tests automatically. (#10540)

Problem

config: enabled: false

Solution

Check for the config: enabled variable while parsing the unit test. If it is set to false, mark the unit test as disabled.

Checklist

cla-bot[bot] commented 1 month ago

Thanks for your pull request, and welcome to our community! We require contributors to sign our Contributor License Agreement and we don't seem to have your signature on file. Check out this article for more information on why we have a CLA.

In order for us to review and merge your code, please submit the Individual Contributor License Agreement form attached above above. If you have questions about the CLA, or if you believe you've received this message in error, please reach out through a comment on this PR.

CLA has not been signed by users: @tsturge

github-actions[bot] commented 1 month ago

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[bot] commented 1 month ago

Codecov Report

Attention: Patch coverage is 71.42857% with 4 lines in your changes missing coverage. Please review.

Project coverage is 89.13%. Comparing base (dd77210) to head (56f2300). Report is 11 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #10831 +/- ## ========================================== - Coverage 89.19% 89.13% -0.07% ========================================== Files 183 183 Lines 23496 23508 +12 ========================================== - Hits 20958 20953 -5 - Misses 2538 2555 +17 ``` | [Flag](https://app.codecov.io/gh/dbt-labs/dbt-core/pull/10831/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dbt-labs) | Coverage Δ | | |---|---|---| | [integration](https://app.codecov.io/gh/dbt-labs/dbt-core/pull/10831/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dbt-labs) | `86.44% <71.42%> (-0.14%)` | :arrow_down: | | [unit](https://app.codecov.io/gh/dbt-labs/dbt-core/pull/10831/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dbt-labs) | `62.11% <42.85%> (+0.02%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dbt-labs#carryforward-flags-in-the-pull-request-comment) to find out more. | [Components](https://app.codecov.io/gh/dbt-labs/dbt-core/pull/10831/components?src=pr&el=components&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dbt-labs) | Coverage Δ | | |---|---|---| | [Unit Tests](https://app.codecov.io/gh/dbt-labs/dbt-core/pull/10831/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dbt-labs) | `62.11% <42.85%> (+0.02%)` | :arrow_up: | | [Integration Tests](https://app.codecov.io/gh/dbt-labs/dbt-core/pull/10831/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dbt-labs) | `86.44% <71.42%> (-0.14%)` | :arrow_down: |
cla-bot[bot] commented 1 month ago

Thanks for your pull request, and welcome to our community! We require contributors to sign our Contributor License Agreement and we don't seem to have your signature on file. Check out this article for more information on why we have a CLA.

In order for us to review and merge your code, please submit the Individual Contributor License Agreement form attached above above. If you have questions about the CLA, or if you believe you've received this message in error, please reach out through a comment on this PR.

CLA has not been signed by users: @tsturge

devmessias commented 1 month ago

I like this. Especially because the unit tests are now broken when we have ctx like vars inside the model. The way I was handling this was by commenting them out.