@@ -6116,7 +6116,8 @@ def test_named_variable_macros() -> None:
61166116 )
61176117
61186118 assert model .python_env [c .SQLMESH_VARS ] == Executable .value (
6119- {c .GATEWAY : "in_memory" , "test_var_a" : "test_value" , "overridden_var" : "initial_value" }
6119+ {c .GATEWAY : "in_memory" , "test_var_a" : "test_value" , "overridden_var" : "initial_value" },
6120+ sort_root_dict = True ,
61206121 )
61216122 assert (
61226123 model .render_query_or_raise ().sql ()
@@ -6142,7 +6143,8 @@ def test_variables_in_templates() -> None:
61426143 )
61436144
61446145 assert model .python_env [c .SQLMESH_VARS ] == Executable .value (
6145- {c .GATEWAY : "in_memory" , "test_var_a" : "test_value" , "overridden_var" : "initial_value" }
6146+ {c .GATEWAY : "in_memory" , "test_var_a" : "test_value" , "overridden_var" : "initial_value" },
6147+ sort_root_dict = True ,
61466148 )
61476149 assert (
61486150 model .render_query_or_raise ().sql ()
@@ -6166,7 +6168,8 @@ def test_variables_in_templates() -> None:
61666168 )
61676169
61686170 assert model .python_env [c .SQLMESH_VARS ] == Executable .value (
6169- {c .GATEWAY : "in_memory" , "test_var_a" : "test_value" , "overridden_var" : "initial_value" }
6171+ {c .GATEWAY : "in_memory" , "test_var_a" : "test_value" , "overridden_var" : "initial_value" },
6172+ sort_root_dict = True ,
61706173 )
61716174 assert (
61726175 model .render_query_or_raise ().sql ()
@@ -6305,7 +6308,8 @@ def test_variables_migrated_dbt_package_macro():
63056308 dialect = "bigquery" ,
63066309 )
63076310 assert model .python_env [c .SQLMESH_VARS ] == Executable .value (
6308- {"test_var_a" : "test_var_a_value" , "__dbt_packages__.test.test_var_b" : "test_var_b_value" }
6311+ {"test_var_a" : "test_var_a_value" , "__dbt_packages__.test.test_var_b" : "test_var_b_value" },
6312+ sort_root_dict = True ,
63096313 )
63106314 assert (
63116315 model .render_query ().sql (dialect = "bigquery" )
@@ -6530,7 +6534,8 @@ def test_unrendered_macros_sql_model(mocker: MockerFixture) -> None:
65306534 "physical_var" : "bla" ,
65316535 "virtual_var" : "blb" ,
65326536 "session_var" : "blc" ,
6533- }
6537+ },
6538+ sort_root_dict = True ,
65346539 )
65356540
65366541 assert "location1" in model .physical_properties
@@ -6617,7 +6622,8 @@ def model_with_macros(evaluator, **kwargs):
66176622 "physical_var" : "bla" ,
66186623 "virtual_var" : "blb" ,
66196624 "session_var" : "blc" ,
6620- }
6625+ },
6626+ sort_root_dict = True ,
66216627 )
66226628 assert python_sql_model .enabled
66236629
@@ -6709,7 +6715,7 @@ def model_with_named_variables(
67096715 )
67106716
67116717 assert python_model .python_env [c .SQLMESH_VARS ] == Executable .value (
6712- {"test_var_a" : "test_value" , "start" : "2024-01-01" }
6718+ {"test_var_a" : "test_value" , "start" : "2024-01-01" }, sort_root_dict = True
67136719 )
67146720
67156721 context = ExecutionContext (mocker .Mock (), {}, None , None )
@@ -10576,9 +10582,12 @@ def unimportant_testing_macro(evaluator, *projections):
1057610582 )
1057710583
1057810584 assert m .python_env .get (c .SQLMESH_VARS ) == Executable .value (
10579- {"selector" : "bla" , "bla_variable" : 1 , "baz_variable" : 2 }
10585+ {"selector" : "bla" , "bla_variable" : 1 , "baz_variable" : 2 },
10586+ sort_root_dict = True ,
10587+ )
10588+ assert m .python_env .get (c .SQLMESH_BLUEPRINT_VARS ) == Executable .value (
10589+ {"selector" : "baz" }, sort_root_dict = True
1058010590 )
10581- assert m .python_env .get (c .SQLMESH_BLUEPRINT_VARS ) == Executable .value ({"selector" : "baz" })
1058210591
1058310592
1058410593def test_extract_schema_in_post_statement (tmp_path : Path ) -> None :
0 commit comments