@@ -320,13 +320,21 @@ def test_spcs_runtime_validation(self, workspace_context):
320320 @mock .patch (
321321 "snowflake.cli._plugins.streamlit.streamlit_entity.StreamlitEntity._object_exists"
322322 )
323+ @mock .patch (
324+ "snowflake.cli._plugins.streamlit.streamlit_entity.StreamlitEntity.bundle"
325+ )
323326 def test_deploy_with_spcs_runtime_v2_and_legacy_flag_raises_error (
324- self , mock_object_exists , workspace_context , action_context
327+ self , mock_bundle , mock_object_exists , workspace_context , action_context
325328 ):
326329 """Test that deploying with SPCS runtime v2 and --legacy flag raises a clear error"""
327- from click import ClickException
330+ from snowflake .cli .api .artifacts .bundle_map import BundleMap
331+ from snowflake .cli .api .exceptions import CliError
328332
329333 mock_object_exists .return_value = False
334+ mock_bundle .return_value = BundleMap (
335+ project_root = workspace_context .project_root ,
336+ deploy_root = workspace_context .project_root / "output" ,
337+ )
330338
331339 model = StreamlitEntityModel (
332340 type = "streamlit" ,
@@ -344,8 +352,8 @@ def test_deploy_with_spcs_runtime_v2_and_legacy_flag_raises_error(
344352 )
345353
346354 with pytest .raises (
347- ClickException ,
348- match = "SPCS runtime v2 features .* are not compatible with --legacy flag" ,
355+ CliError ,
356+ match = "runtime_name and compute_pool are not compatible with --legacy flag" ,
349357 ):
350358 entity .action_deploy (
351359 action_context , _open = False , replace = False , legacy = True
0 commit comments