Skip to content

Commit 91eea59

Browse files
committed
Add test
1 parent 876e563 commit 91eea59

1 file changed

Lines changed: 53 additions & 0 deletions

File tree

tests/cli/test_cli.py

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1706,3 +1706,56 @@ def test_dbt_init(tmp_path):
17061706
config = sqlmesh_config(Path(__file__).parent)
17071707
"""
17081708
)
1709+
1710+
1711+
def test_ignore_warnings(runner: CliRunner, tmp_path: Path) -> None:
1712+
create_example_project(tmp_path)
1713+
1714+
# Add non-blocking audit to generate WARNING
1715+
with open(tmp_path / "models" / "full_model.sql", "w", encoding="utf-8") as f:
1716+
f.write("""
1717+
MODEL (
1718+
name sqlmesh_example.full_model,
1719+
kind FULL,
1720+
cron '@daily',
1721+
grain item_id,
1722+
audits (full_nonblocking_audit),
1723+
);
1724+
1725+
SELECT
1726+
item_id,
1727+
COUNT(DISTINCT id) AS num_orders,
1728+
FROM
1729+
sqlmesh_example.incremental_model
1730+
GROUP BY item_id;
1731+
1732+
AUDIT (
1733+
name full_nonblocking_audit,
1734+
blocking false,
1735+
);
1736+
select 1 as a;
1737+
""")
1738+
1739+
audit_warning = "[WARNING] sqlmesh_example.full_model: 'full_nonblocking_audit' audit error: "
1740+
1741+
result = runner.invoke(
1742+
cli,
1743+
["--paths", str(tmp_path), "plan", "--no-prompts", "--auto-apply", "--skip-tests"],
1744+
)
1745+
assert result.exit_code == 0
1746+
assert audit_warning in result.output
1747+
1748+
result = runner.invoke(
1749+
cli,
1750+
[
1751+
"--ignore-warnings",
1752+
"--paths",
1753+
str(tmp_path),
1754+
"plan",
1755+
"--no-prompts",
1756+
"--auto-apply",
1757+
"--skip-tests",
1758+
],
1759+
)
1760+
assert result.exit_code == 0
1761+
assert audit_warning not in result.output

0 commit comments

Comments
 (0)