-
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
[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 |
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: