-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import pytest | ||
|
||
from dbt.tests.util import run_dbt | ||
|
||
single_test_sql = """ | ||
{{ config(warn_if = '>0', error_if ="> 10") }} | ||
select 1 as issue | ||
""" | ||
|
||
|
||
class TestSingularTestWarnError: | ||
@pytest.fixture(scope="class") | ||
def tests(self): | ||
return {"single_test.sql": single_test_sql} | ||
|
||
def test_singular_test_warn_error(self, project): | ||
results = run_dbt(["--warn-error", "test"], expect_pass=False) | ||
assert results.results[0].status == "fail" | ||
|
||
def test_singular_test_warn_error_options(self, project): | ||
results = run_dbt( | ||
["--warn-error-options", "{'include': 'all'}", "test"], expect_pass=False | ||
) | ||
assert results.results[0].status == "fail" | ||
|
||
def test_singular_test_equals_warn_error(self, project): | ||
results = run_dbt(["--warn-error", "test"], expect_pass=False) | ||
warn_error_result = results.results[0].status | ||
|
||
results = run_dbt( | ||
["--warn-error-options", "{'include': 'all'}", "test"], expect_pass=False | ||
) | ||
assert warn_error_result == results.results[0].status |