-
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
[Feature] Disable unit tests whose model is disabled #10540
Comments
I see what you are saying @SimonCarryer 👍 Specifically, both generic and singular data tests are disabled when they depend on a model that is disabled, and you'd like unit tests to behave the same way. This looks like the expected behavior to me though, so I'm going to update this to a feature request for further consideration. We should also consider unit tests through the lens of indirect selection for data tests. This is similar to #9109, but distinct.
|
Oh no! As best I can tell, unit tests on disabled models are already disabled. The issue is that if the model is disabled by a macro, rather than in plain text, then the unit test is still compiled (and causes a compilation error). |
The example in #10540 (comment) just disables the model in YAML like this (which uses plain text rather than a macro):
And it leaves all the unit tests related to that model as enabled and gives the compilation error you mentioned. Are you seeing something different? i.e., do you have an example where the unit test is disabled? As an aside, when I disable a model using
|
Also, when a model is disabled, disable the corresponding unit tests automatically. (#10540)
Also, when a model is disabled, disable the corresponding unit tests automatically. (#10540)
Closed by #10831 |
Can this issue be reopened? The PR that closed this issue allows for unit tests to be disabled, but I don't believe it solves the problem raised in this issue of a model being disabled for which a unit test is defined. I'm still getting parsing errors when a model is disabled and a unit test is not explicitly disabled:
Whether I have the model disabled using conditional logic such as I don't know enough but how this all works to say why, but it looks like this PR made additions to I'm testing this out on dbt-core v1.9.1 and dbt-bigquery v1.9.1. Please let me know if no one else can replicate this error and this is due to something I'm doing - thanks! |
@davidbooke4 I am facing the same issue while running models with dynamic config and the unit test fails. Note: commented here to track the issue. |
Thank you @davidbooke4 and @gauravbodara - I will open this issue back up! |
Is this a new bug in dbt-core?
Current Behavior
If a model is set to disabled by a macro (for example the standard
config
macro), then the enabled status is not known at compile time, and unit tests for the model are still compiled. This causes a compilation error:Expected Behavior
Usually, if a model is disabled (i.e.
enabled: false
), then unit tests which test that model are not compiled.Steps To Reproduce
{{config(enabled=false)}}
)Relevant log output
No response
Environment
Which database adapter are you using with dbt?
postgres
Additional Context
No response
The text was updated successfully, but these errors were encountered: