@@ -113,48 +113,56 @@ def test_streamlit_deploy(
113113
114114@pytest .mark .integration
115115def test_streamlit_deploy_prune_flag (runner , test_database , project_directory ):
116- # With versioned deployment (default), files are uploaded to a managed stage
117- # at snow://streamlit/{DB}.{SCHEMA}.{IDENTIFIER}/versions/live
116+ # Test prune functionality with legacy (ROOT_LOCATION) deployment
117+ # Versioned stages are managed differently and don't support manual file uploads well
118118 streamlit_identifier = "TEST_STREAMLIT_DEPLOY_SNOWCLI"
119- versioned_stage_path = f"snow://streamlit/{ test_database .upper ()} .PUBLIC.{ streamlit_identifier } /versions/live"
119+ stage_name = f"{ test_database } .public.streamlit"
120+ stage_path = f"@{ stage_name } /test_streamlit_deploy_snowcli"
120121
121122 def _assert_file_names_on_stage (expected_files : List [str ]) -> None :
122123 result = runner .invoke_with_connection_json (
123- ["stage" , "list-files" , versioned_stage_path ]
124+ [
125+ "stage" ,
126+ "list-files" ,
127+ stage_name ,
128+ "--pattern" ,
129+ "test_streamlit_deploy_snowcli/.*" ,
130+ ]
124131 )
125132 assert result .exit_code == 0 , result .output
126133 actual_files = set (
127- file ["name" ].removeprefix ("/versions/live/" ) for file in result .json
134+ file ["name" ].removeprefix ("test_streamlit_deploy_snowcli/" )
135+ for file in result .json
128136 )
129137 assert actual_files == set (
130138 expected_files
131139 ), f"Expected { expected_files } but got { actual_files } "
132140
133141 with project_directory (f"streamlit_v2" ) as project_root :
134- # deploy streamlit first to create the managed stage
142+ # deploy streamlit with legacy flag to use ROOT_LOCATION stages
135143 result = runner .invoke_with_connection (
136- ["streamlit" , "deploy" , "my_streamlit" , "--replace" ]
144+ ["streamlit" , "deploy" , "my_streamlit" , "--replace" , "--legacy" ]
137145 )
138146 assert result .exit_code == 0 , result .output
139147 _assert_file_names_on_stage (["streamlit_app.py" ])
140148
141- # upload unexpected file to the versioned stage
149+ # upload unexpected file to the stage
142150 unexpected_file = project_root / "unexpected.txt"
143151 unexpected_file .write_text ("This is unexpected" )
144152 result = runner .invoke_with_connection (
145153 [
146154 "stage" ,
147155 "copy" ,
148156 str (unexpected_file ),
149- versioned_stage_path ,
157+ stage_path ,
150158 "--overwrite" ,
151159 ]
152160 )
153161 assert result .exit_code == 0 , result .output
154162
155163 # deploy streamlit again without prune - unexpected file should remain on stage
156164 result = runner .invoke_with_connection (
157- ["streamlit" , "deploy" , "my_streamlit" , "--replace" ]
165+ ["streamlit" , "deploy" , "my_streamlit" , "--replace" , "--legacy" ]
158166 )
159167 assert result .exit_code == 0 , result .output
160168 _assert_file_names_on_stage (
@@ -166,7 +174,7 @@ def _assert_file_names_on_stage(expected_files: List[str]) -> None:
166174
167175 # deploy with --prune flag - unexpected file should be removed
168176 result = runner .invoke_with_connection (
169- ["streamlit" , "deploy" , "my_streamlit" , "--replace" , "--prune" ]
177+ ["streamlit" , "deploy" , "my_streamlit" , "--replace" , "--legacy" , "-- prune" ]
170178 )
171179 assert result .exit_code == 0 , result .output
172180 _assert_file_names_on_stage (["streamlit_app.py" ])
0 commit comments