[CT-2686] Incorrectly set up tests in test_query_comment.py #7845
Labels
bug
Something isn't working
help_wanted
Trickier changes, with a clear starting point, good for previous/experienced contributors
Team:Adapters
Issues designated for the adapter area of the code
Is this a new bug in dbt-core?
Current Behavior
Tests in test_query_comment.py are incorrectly set up. They are always passing, no matter if query comments are correctly implemented.
Assertions are placed in functions named
matches_comment
. As pytest run functions with names prefixed withtest
, these assertions are never checked.The only thing which this tests are doing, is invoking test_comments function, which invokes run_assert_comments, which invokes run_get_json, which is capturing logs. There are no assertions in any of above functions.
Additionally, I think that it would be better to check in dbt_run result query if query-comments were added, instead of checking in logs.
Expected Behavior
Tests should detect bugs instead of always pass.
Steps To Reproduce
matches_comment
, to wrong assertion e.g.assert 0 == 1
. Run tests, notice that they are still passing.Relevant log output
No response
Environment
Which database adapter are you using with dbt?
postgres
Additional Context
I'm willing to create PR for this issue, as I already overwrote these tests in dbt-trino to test
query-comments
properly on this adapter.The text was updated successfully, but these errors were encountered: