1212# See the License for the specific language governing permissions and
1313# limitations under the License.
1414
15+ import os
1516import uuid
1617from pathlib import Path
1718from typing import List
@@ -116,7 +117,7 @@ def test_streamlit_deploy_prune_flag(runner, test_database, project_directory):
116117 # Test prune functionality with legacy (ROOT_LOCATION) deployment
117118 # Versioned stages are managed differently and don't support manual file uploads well
118119 streamlit_identifier = "TEST_STREAMLIT_DEPLOY_SNOWCLI"
119- stage_name = f" { test_database } .public. streamlit"
120+ stage_name = " streamlit"
120121 stage_path = f"@{ stage_name } /test_streamlit_deploy_snowcli"
121122
122123 def _assert_file_names_on_stage (expected_files : List [str ]) -> None :
@@ -125,15 +126,10 @@ def _assert_file_names_on_stage(expected_files: List[str]) -> None:
125126 "stage" ,
126127 "list-files" ,
127128 stage_name ,
128- "--pattern" ,
129- "test_streamlit_deploy_snowcli/.*" ,
130129 ]
131130 )
132131 assert result .exit_code == 0 , result .output
133- actual_files = set (
134- file ["name" ].removeprefix ("test_streamlit_deploy_snowcli/" )
135- for file in result .json
136- )
132+ actual_files = set (file ["name" ] for file in result .json )
137133 assert actual_files == set (
138134 expected_files
139135 ), f"Expected { expected_files } but got { actual_files } "
@@ -144,7 +140,9 @@ def _assert_file_names_on_stage(expected_files: List[str]) -> None:
144140 ["streamlit" , "deploy" , "my_streamlit" , "--replace" , "--legacy" ]
145141 )
146142 assert result .exit_code == 0 , result .output
147- _assert_file_names_on_stage (["streamlit_app.py" ])
143+ _assert_file_names_on_stage (
144+ ["streamlit/test_streamlit_deploy_snowcli/streamlit_app.py" ]
145+ )
148146
149147 # upload unexpected file to the stage
150148 unexpected_file = project_root / "unexpected.txt"
@@ -167,8 +165,8 @@ def _assert_file_names_on_stage(expected_files: List[str]) -> None:
167165 assert result .exit_code == 0 , result .output
168166 _assert_file_names_on_stage (
169167 [
170- "unexpected.txt" ,
171- "streamlit_app.py" ,
168+ "streamlit/test_streamlit_deploy_snowcli/ unexpected.txt" ,
169+ "streamlit/test_streamlit_deploy_snowcli/ streamlit_app.py" ,
172170 ]
173171 )
174172
@@ -177,7 +175,9 @@ def _assert_file_names_on_stage(expected_files: List[str]) -> None:
177175 ["streamlit" , "deploy" , "my_streamlit" , "--replace" , "--legacy" , "--prune" ]
178176 )
179177 assert result .exit_code == 0 , result .output
180- _assert_file_names_on_stage (["streamlit_app.py" ])
178+ _assert_file_names_on_stage (
179+ ["streamlit/test_streamlit_deploy_snowcli/streamlit_app.py" ]
180+ )
181181
182182
183183@pytest .mark .integration
0 commit comments