Skip to content

Commit

Permalink
add functional test
Browse files Browse the repository at this point in the history
  • Loading branch information
jx2lee committed Mar 27, 2024
1 parent fb0d448 commit 2950572
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions tests/functional/test_singular_tests.py
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

0 comments on commit 2950572

Please sign in to comment.