@@ -3745,7 +3745,7 @@ def test_materialized_view_evaluation(ctx: TestContext, mocker: MockerFixture):
37453745 pytest .skip (f"Skipping { dialect } as they're not enabled on standard accounts" )
37463746
37473747 model_name = ctx .table ("test_tbl" )
3748- mview_name = ctx .table ("test_mview " )
3748+ mview_name = ctx .table ("test_mview1 " )
37493749
37503750 sqlmesh = ctx .create_context ()
37513751
@@ -3772,12 +3772,15 @@ def test_materialized_view_evaluation(ctx: TestContext, mocker: MockerFixture):
37723772 )
37733773 )
37743774 )
3775+
3776+ def _assert_mview_value (value : int ):
3777+ df = adapter .fetchdf (f"SELECT * FROM { mview_name .sql (dialect = dialect )} " )
3778+ assert df ["col" ][0 ] == value
37753779
37763780 # Case 1: Ensure that plan is successful and we can query the materialized view
37773781 sqlmesh .plan (auto_apply = True , no_prompts = True )
37783782
3779- df = adapter .fetchdf (f"SELECT * FROM { mview_name .sql (dialect = dialect )} " )
3780- assert df ["col" ][0 ] == 1
3783+ _assert_mview_value (value = 1 )
37813784
37823785 # Case 2: Ensure that we can change the underlying table and the materialized view is recreated
37833786 sqlmesh .upsert_model (
@@ -3789,11 +3792,7 @@ def test_materialized_view_evaluation(ctx: TestContext, mocker: MockerFixture):
37893792 with mock .patch .object (logger , "info" ) as mock_logger :
37903793 sqlmesh .plan (auto_apply = True , no_prompts = True )
37913794
3792- # RisingWave does not need to recreate the mview, all other engines do
3793- recreate_view = (
3794- "Skipping creation of the view" if dialect == "risingwave" else "Replacing view"
3795- )
3796- assert any (recreate_view in call [0 ][0 ] for call in mock_logger .call_args_list )
3795+ assert any ("Replacing view" in call [0 ][0 ] for call in mock_logger .call_args_list )
3796+
37973797
3798- df = adapter .fetchdf (f"SELECT * FROM { mview_name .sql (dialect = dialect )} " )
3799- assert df ["col" ][0 ] == 2
3798+ _assert_mview_value (value = 2 )
0 commit comments