From 6b61c7f7cf33f7d364b512318c215efb708dfdd5 Mon Sep 17 00:00:00 2001 From: Adam Stus Date: Mon, 2 Dec 2024 15:19:08 +0100 Subject: [PATCH] Moved Snowpark and Streamlit artifacts to separate directory in output/deploy --- .../cli/_plugins/snowpark/commands.py | 6 +- .../snowpark/snowpark_project_paths.py | 6 +- .../streamlit/streamlit_project_paths.py | 5 + .../cli/api/project/project_paths.py | 2 +- tests/snowpark/test_artifacts.py | 42 ++++---- tests/snowpark/test_build.py | 4 +- tests/snowpark/test_function.py | 6 +- tests/snowpark/test_procedure.py | 4 +- tests/snowpark/test_project_paths.py | 53 +++++----- tests/streamlit/test_artifacts.py | 100 +++++++++++------- tests/streamlit/test_commands.py | 2 +- 11 files changed, 137 insertions(+), 93 deletions(-) diff --git a/src/snowflake/cli/_plugins/snowpark/commands.py b/src/snowflake/cli/_plugins/snowpark/commands.py index 28db01d068..dab880149f 100644 --- a/src/snowflake/cli/_plugins/snowpark/commands.py +++ b/src/snowflake/cli/_plugins/snowpark/commands.py @@ -220,19 +220,19 @@ def build_artifacts_mappings( ) -> Tuple[EntityToImportPathsMapping, StageToArtefactMapping]: stages_to_artifact_map: StageToArtefactMapping = defaultdict(set) entities_to_imports_map: EntityToImportPathsMapping = defaultdict(set) - for entity_id, entity in snowpark_entities.items(): + for name, entity in snowpark_entities.items(): stage = entity.stage required_artifacts = set() for artefact in entity.artifacts: artefact_dto = project_paths.get_artefact_dto(artefact) required_artifacts.add(artefact_dto) - entities_to_imports_map[entity_id].add(artefact_dto.import_path(stage)) + entities_to_imports_map[name].add(artefact_dto.import_path(stage)) stages_to_artifact_map[stage].update(required_artifacts) deps_artefact = project_paths.get_dependencies_artefact() if deps_artefact.post_build_path.exists(): stages_to_artifact_map[stage].add(deps_artefact) - entities_to_imports_map[entity_id].add(deps_artefact.import_path(stage)) + entities_to_imports_map[name].add(deps_artefact.import_path(stage)) return entities_to_imports_map, stages_to_artifact_map diff --git a/src/snowflake/cli/_plugins/snowpark/snowpark_project_paths.py b/src/snowflake/cli/_plugins/snowpark/snowpark_project_paths.py index 6e103d840e..249efea175 100644 --- a/src/snowflake/cli/_plugins/snowpark/snowpark_project_paths.py +++ b/src/snowflake/cli/_plugins/snowpark/snowpark_project_paths.py @@ -74,6 +74,10 @@ def snowflake_requirements(self) -> SecurePath: def requirements(self) -> SecurePath: return SecurePath(self.path_relative_to_root(Path("requirements.txt"))) + @property + def deploy_root(self) -> Path: + return self.project_root / "output" / "deploy" / "snowpark" + @dataclass(unsafe_hash=True) class Artefact: @@ -154,7 +158,7 @@ def import_path(self, stage: FQN | str | None) -> str: return self.upload_path(stage) + self._artefact_name def deploy_root(self) -> Path: - return self.project_root / "output" + return self.project_root / "output" / "deploy" / "snowpark" def _is_dest_a_file(self) -> bool: if not self.dest: diff --git a/src/snowflake/cli/_plugins/streamlit/streamlit_project_paths.py b/src/snowflake/cli/_plugins/streamlit/streamlit_project_paths.py index fbe89959b2..e1642f53f2 100644 --- a/src/snowflake/cli/_plugins/streamlit/streamlit_project_paths.py +++ b/src/snowflake/cli/_plugins/streamlit/streamlit_project_paths.py @@ -14,6 +14,7 @@ from __future__ import annotations from dataclasses import dataclass +from pathlib import Path from snowflake.cli.api.project.project_paths import ProjectPaths @@ -23,3 +24,7 @@ class StreamlitProjectPaths(ProjectPaths): """ This class allows you to manage files paths related to given project. """ + + @property + def deploy_root(self) -> Path: + return self.project_root / "output" / "deploy" / "streamlit" diff --git a/src/snowflake/cli/api/project/project_paths.py b/src/snowflake/cli/api/project/project_paths.py index f6b2a14d99..8d67d212cc 100644 --- a/src/snowflake/cli/api/project/project_paths.py +++ b/src/snowflake/cli/api/project/project_paths.py @@ -9,7 +9,7 @@ class ProjectPaths: @property def deploy_root(self) -> Path: - return self.project_root / "output" + return self.project_root / "output" / "deploy" def remove_up_deploy_root(self) -> None: if self.deploy_root.exists(): diff --git a/tests/snowpark/test_artifacts.py b/tests/snowpark/test_artifacts.py index c573ab9b6d..efe55a08bc 100644 --- a/tests/snowpark/test_artifacts.py +++ b/tests/snowpark/test_artifacts.py @@ -12,42 +12,44 @@ lambda _: True, ) +deploy_root = Path("output") / "deploy" / "snowpark" + @pytest.mark.parametrize( "artifacts, local_path, stage_path", [ - ("src", Path("output") / "src.zip", "/"), - ("src/", Path("output") / "src.zip", "/"), - ("src/*", Path("output") / "src.zip", "/"), - ("src/*.py", Path("output") / "src.zip", "/"), + ("src", deploy_root / "src.zip", "/"), + ("src/", deploy_root / "src.zip", "/"), + ("src/*", deploy_root / "src.zip", "/"), + ("src/*.py", deploy_root / "src.zip", "/"), ( "src/dir/dir_app.py", - Path("output") / "src" / "dir" / "dir_app.py", + deploy_root / "src" / "dir" / "dir_app.py", "/src/dir/", ), ( {"src": "src/**/*", "dest": "source/"}, - Path("output") / "source" / "src.zip", + deploy_root / "source" / "src.zip", "/source/", ), ( {"src": "src", "dest": "source/"}, - Path("output") / "source" / "src.zip", + deploy_root / "source" / "src.zip", "/source/", ), ( {"src": "src/", "dest": "source/"}, - Path("output") / "source" / "src.zip", + deploy_root / "source" / "src.zip", "/source/", ), ( {"src": "src/*", "dest": "source/"}, - Path("output") / "source" / "src.zip", + deploy_root / "source" / "src.zip", "/source/", ), ( {"src": "src/dir/dir_app.py", "dest": "source/dir/apps/"}, - "output/source/dir/apps/dir_app.py", + deploy_root / "source" / "dir" / "apps" / "dir_app.py", "/source/dir/apps/", ), ], @@ -111,38 +113,38 @@ def test_build_and_deploy_with_artifacts( @pytest.mark.parametrize( "artifact, local_path, stage_path", [ - ("src", Path("output") / "src.zip", "/"), - ("src/", Path("output") / "src.zip", "/"), - ("src/*", Path("output") / "src.zip", "/"), - ("src/*.py", Path("output") / "src.zip", "/"), + ("src", deploy_root / "src.zip", "/"), + ("src/", deploy_root / "src.zip", "/"), + ("src/*", deploy_root / "src.zip", "/"), + ("src/*.py", deploy_root / "src.zip", "/"), ( "src/dir/dir_app.py", - Path("output") / "src" / "dir" / "dir_app.py", + deploy_root / "src" / "dir" / "dir_app.py", "/src/dir/", ), ( {"src": "src/**/*", "dest": "source/"}, - Path("output") / "source" / "src.zip", + deploy_root / "source" / "src.zip", "/source/", ), ( {"src": "src", "dest": "source/"}, - Path("output") / "source" / "src.zip", + deploy_root / "source" / "src.zip", "/source/", ), ( {"src": "src/", "dest": "source/"}, - Path("output") / "source" / "src.zip", + deploy_root / "source" / "src.zip", "/source/", ), ( {"src": "src/*", "dest": "source/"}, - Path("output") / "source" / "src.zip", + deploy_root / "source" / "src.zip", "/source/", ), ( {"src": "src/dir/dir_app.py", "dest": "source/dir/apps/"}, - Path("output") / "source" / "dir" / "apps" / "dir_app.py", + deploy_root / "source" / "dir" / "apps" / "dir_app.py", "/source/dir/apps/", ), ], diff --git a/tests/snowpark/test_build.py b/tests/snowpark/test_build.py index 9298ed2b32..cefc902fb2 100644 --- a/tests/snowpark/test_build.py +++ b/tests/snowpark/test_build.py @@ -58,7 +58,9 @@ def test_build_with_glob_patterns_in_artifacts( result = runner.invoke(["snowpark", "build", "--ignore-anaconda"]) assert result.exit_code == 0, result.output - _assert_zip_contains(tmp_dir / "output" / zip_name, expected_files) + _assert_zip_contains( + tmp_dir / "output" / "deploy" / "snowpark" / zip_name, expected_files + ) def _assert_zip_contains(app_zip: str, expected_files: Set[str]): diff --git a/tests/snowpark/test_function.py b/tests/snowpark/test_function.py index 7ee4a27072..2fe20ac539 100644 --- a/tests/snowpark/test_function.py +++ b/tests/snowpark/test_function.py @@ -214,7 +214,7 @@ def test_deploy_function_no_changes( ] assert queries == [ "create stage if not exists IDENTIFIER('MockDatabase.MockSchema.dev_deployment') comment='deployments managed by Snowflake CLI'", - f"put file://{Path(project_dir).resolve()}/output/my_snowpark_project/app.py @MockDatabase.MockSchema.dev_deployment/my_snowpark_project/ auto_compress=false parallel=4 overwrite=True", + f"put file://{Path(project_dir).resolve()}/output/deploy/snowpark/my_snowpark_project/app.py @MockDatabase.MockSchema.dev_deployment/my_snowpark_project/ auto_compress=false parallel=4 overwrite=True", ] @@ -259,7 +259,7 @@ def test_deploy_function_needs_update_because_packages_changes( ] assert queries == [ "create stage if not exists IDENTIFIER('MockDatabase.MockSchema.dev_deployment') comment='deployments managed by Snowflake CLI'", - f"put file://{Path(project_dir).resolve()}/output/my_snowpark_project/app.py @MockDatabase.MockSchema.dev_deployment/my_snowpark_project/ auto_compress=false parallel=4 overwrite=True", + f"put file://{Path(project_dir).resolve()}/output/deploy/snowpark/my_snowpark_project/app.py @MockDatabase.MockSchema.dev_deployment/my_snowpark_project/ auto_compress=false parallel=4 overwrite=True", dedent( """\ create or replace function IDENTIFIER('MockDatabase.MockSchema.func1')(a string default 'default value', b variant) @@ -316,7 +316,7 @@ def test_deploy_function_needs_update_because_handler_changes( ] assert queries == [ "create stage if not exists IDENTIFIER('MockDatabase.MockSchema.dev_deployment') comment='deployments managed by Snowflake CLI'", - f"put file://{Path(project_dir).resolve()}/output/my_snowpark_project/app.py @MockDatabase.MockSchema.dev_deployment/my_snowpark_project/" + f"put file://{Path(project_dir).resolve()}/output/deploy/snowpark/my_snowpark_project/app.py @MockDatabase.MockSchema.dev_deployment/my_snowpark_project/" f" auto_compress=false parallel=4 overwrite=True", dedent( """\ diff --git a/tests/snowpark/test_procedure.py b/tests/snowpark/test_procedure.py index fc13e1e6ef..c1c6d7de24 100644 --- a/tests/snowpark/test_procedure.py +++ b/tests/snowpark/test_procedure.py @@ -105,7 +105,7 @@ def test_deploy_procedure( ) assert ctx.get_queries() == [ "create stage if not exists IDENTIFIER('MockDatabase.MockSchema.dev_deployment') comment='deployments managed by Snowflake CLI'", - f"put file://{Path(tmp).resolve()}/output/my_snowpark_project/app.py @MockDatabase.MockSchema.dev_deployment/my_snowpark_project/ auto_compress=false parallel=4 overwrite=True", + f"put file://{Path(tmp).resolve()}/output/deploy/snowpark/my_snowpark_project/app.py @MockDatabase.MockSchema.dev_deployment/my_snowpark_project/ auto_compress=false parallel=4 overwrite=True", dedent( """\ create or replace procedure IDENTIFIER('MockDatabase.MockSchema.procedureName')(name string) @@ -190,7 +190,7 @@ def test_deploy_procedure_with_external_access( ) assert ctx.get_queries() == [ "create stage if not exists IDENTIFIER('MockDatabase.MockSchema.dev_deployment') comment='deployments managed by Snowflake CLI'", - f"put file://{Path(project_dir).resolve()}/output/my_snowpark_project/app.py @MockDatabase.MockSchema.dev_deployment/my_snowpark_project/" + f"put file://{Path(project_dir).resolve()}/output/deploy/snowpark/my_snowpark_project/app.py @MockDatabase.MockSchema.dev_deployment/my_snowpark_project/" f" auto_compress=false parallel=4 overwrite=True", dedent( """\ diff --git a/tests/snowpark/test_project_paths.py b/tests/snowpark/test_project_paths.py index 55796e1a98..80b22fe6ff 100644 --- a/tests/snowpark/test_project_paths.py +++ b/tests/snowpark/test_project_paths.py @@ -4,6 +4,9 @@ import pytest from snowflake.cli._plugins.snowpark.snowpark_project_paths import Artefact +deploy_path = Path("output") / "deploy" / "snowpark" +absolute_deploy_path = Path.cwd().absolute() / "output" / "deploy" / "snowpark" + @pytest.mark.parametrize( "path, dest, is_file, expected_path", @@ -69,34 +72,34 @@ def test_artifact_upload_path(mock_ctx_context, path, dest, is_file, expected_pa @pytest.mark.parametrize( "path, dest, is_file, expected_path", [ - ("src", None, False, Path("output") / "src.zip"), - ("src/", None, False, Path("output") / "src.zip"), - ("src", "source", False, Path("output") / "source" / "src.zip"), - ("src/app.py", None, True, Path("output") / "src" / "app.py"), + ("src", None, False, deploy_path / "src.zip"), + ("src/", None, False, deploy_path / "src.zip"), + ("src", "source", False, deploy_path / "source" / "src.zip"), + ("src/app.py", None, True, deploy_path / "src" / "app.py"), ( "src/app.py", "source/new_app.py", True, - Path("output") / "source" / "new_app.py", + deploy_path / "source" / "new_app.py", ), - ("src/*", "source/new_app.py", True, Path("output") / "source" / "new_app.py"), + ("src/*", "source/new_app.py", True, deploy_path / "source" / "new_app.py"), ( "src/dir/dir2/app.py", None, True, - Path("output") / "src" / "dir" / "dir2" / "app.py", + deploy_path / "src" / "dir" / "dir2" / "app.py", ), ( "src/dir/dir2/app.py", "source/", True, - Path("output") / "source" / "app.py", + deploy_path / "source" / "app.py", ), - ("src/*", "source/", False, Path("output") / "source" / "src.zip"), - ("src/**/*.py", None, False, Path("output") / "src.zip"), - ("src/**/*.py", "source/", False, Path("output") / "source" / "src.zip"), - ("src/app*", None, False, Path("output") / "src.zip"), - ("src/app[1-5].py", None, False, Path("output") / "src.zip"), + ("src/*", "source/", False, deploy_path / "source" / "src.zip"), + ("src/**/*.py", None, False, deploy_path / "src.zip"), + ("src/**/*.py", "source/", False, deploy_path / "source" / "src.zip"), + ("src/app*", None, False, deploy_path / "src.zip"), + ("src/app[1-5].py", None, False, deploy_path / "src.zip"), ], ) def test_artifact_post_build_path(path, dest, is_file, expected_path): @@ -174,48 +177,48 @@ def test_artifact_upload_path_from_other_directory( @pytest.mark.parametrize( "path, dest, is_file, expected_path", [ - ("src", None, False, Path.cwd().absolute() / "output" / "src.zip"), - ("src/", None, False, Path.cwd().absolute() / "output" / "src.zip"), + ("src", None, False, absolute_deploy_path / "src.zip"), + ("src/", None, False, absolute_deploy_path / "src.zip"), ( "src", "source", False, - Path.cwd().absolute() / "output" / "source" / "src.zip", + absolute_deploy_path / "source" / "src.zip", ), - ("src/app.py", None, True, Path.cwd().absolute() / "output" / "src" / "app.py"), + ("src/app.py", None, True, absolute_deploy_path / "src" / "app.py"), ( "src/app.py", "source/new_app.py", True, - Path.cwd().absolute() / "output" / "source" / "new_app.py", + absolute_deploy_path / "source" / "new_app.py", ), ( "src/dir/dir2/app.py", None, True, - Path.cwd().absolute() / "output" / "src" / "dir" / "dir2" / "app.py", + absolute_deploy_path / "src" / "dir" / "dir2" / "app.py", ), ( "src/dir/dir2/app.py", "source/", True, - Path.cwd().absolute() / "output" / "source" / "app.py", + absolute_deploy_path / "source" / "app.py", ), ( "src/*", "source/", False, - Path.cwd().absolute() / "output" / "source" / "src.zip", + absolute_deploy_path / "source" / "src.zip", ), - ("src/**/*.py", None, False, Path.cwd().absolute() / "output" / "src.zip"), + ("src/**/*.py", None, False, absolute_deploy_path / "src.zip"), ( "src/**/*.py", "source/", False, - Path.cwd().absolute() / "output" / "source" / "src.zip", + absolute_deploy_path / "source" / "src.zip", ), - ("src/app*", None, False, Path.cwd().absolute() / "output" / "src.zip"), - ("src/app[1-5].py", None, False, Path.cwd().absolute() / "output" / "src.zip"), + ("src/app*", None, False, absolute_deploy_path / "src.zip"), + ("src/app[1-5].py", None, False, absolute_deploy_path / "src.zip"), ], ) def test_artifact_post_build_path_from_other_directory( diff --git a/tests/streamlit/test_artifacts.py b/tests/streamlit/test_artifacts.py index 4b75406d1c..ff0acd0cb5 100644 --- a/tests/streamlit/test_artifacts.py +++ b/tests/streamlit/test_artifacts.py @@ -6,6 +6,8 @@ from snowflake.cli._plugins.connection.util import UIParameter from snowflake.connector.compat import IS_WINDOWS +deploy_root = Path("output") / "deploy" / "streamlit" + @pytest.mark.parametrize( "artifacts, paths", @@ -13,9 +15,9 @@ ( "src", [ - {"local": Path("output") / "src" / "app.py", "stage": "/src"}, + {"local": deploy_root / "src" / "app.py", "stage": "/src"}, { - "local": Path("output") / "src" / "dir" / "dir_app.py", + "local": deploy_root / "src" / "dir" / "dir_app.py", "stage": "/src/dir", }, ], @@ -23,9 +25,9 @@ ( "src/", [ - {"local": Path("output") / "src" / "app.py", "stage": "/src"}, + {"local": deploy_root / "src" / "app.py", "stage": "/src"}, { - "local": Path("output") / "src" / "dir" / "dir_app.py", + "local": deploy_root / "src" / "dir" / "dir_app.py", "stage": "/src/dir", }, ], @@ -33,19 +35,19 @@ ( "src/*", [ - {"local": Path("output") / "src" / "app.py", "stage": "/src"}, + {"local": deploy_root / "src" / "app.py", "stage": "/src"}, { - "local": Path("output") / "src" / "dir" / "dir_app.py", + "local": deploy_root / "src" / "dir" / "dir_app.py", "stage": "/src/dir", }, ], ), - ("src/*.py", [{"local": Path("output") / "src" / "app.py", "stage": "/src"}]), + ("src/*.py", [{"local": deploy_root / "src" / "app.py", "stage": "/src"}]), ( "src/dir/dir_app.py", [ { - "local": Path("output") / "src" / "dir" / "dir_app.py", + "local": deploy_root / "src" / "dir" / "dir_app.py", "stage": "/src/dir", } ], @@ -53,10 +55,10 @@ ( {"src": "src/**/*", "dest": "source/"}, [ - {"local": Path("output") / "source" / "app.py", "stage": "/source"}, - {"local": Path("output") / "source" / "dir_app.py", "stage": "/source"}, + {"local": deploy_root / "source" / "app.py", "stage": "/source"}, + {"local": deploy_root / "source" / "dir_app.py", "stage": "/source"}, { - "local": Path("output") / "source" / "dir" / "dir_app.py", + "local": deploy_root / "source" / "dir" / "dir_app.py", "stage": "/source/dir", }, ], @@ -65,11 +67,11 @@ {"src": "src", "dest": "source/"}, [ { - "local": Path("output") / "source" / "src" / "app.py", + "local": deploy_root / "source" / "src" / "app.py", "stage": "/source/src", }, { - "local": Path("output") / "source" / "src" / "dir" / "dir_app.py", + "local": deploy_root / "source" / "src" / "dir" / "dir_app.py", "stage": "/source/src/dir", }, ], @@ -78,11 +80,11 @@ {"src": "src/", "dest": "source/"}, [ { - "local": Path("output") / "source" / "src" / "app.py", + "local": deploy_root / "source" / "src" / "app.py", "stage": "/source/src", }, { - "local": Path("output") / "source" / "src" / "dir" / "dir_app.py", + "local": deploy_root / "source" / "src" / "dir" / "dir_app.py", "stage": "/source/src/dir", }, ], @@ -90,9 +92,9 @@ ( {"src": "src/*", "dest": "source/"}, [ - {"local": Path("output") / "source" / "app.py", "stage": "/source"}, + {"local": deploy_root / "source" / "app.py", "stage": "/source"}, { - "local": Path("output") / "source" / "dir" / "dir_app.py", + "local": deploy_root / "source" / "dir" / "dir_app.py", "stage": "/source/dir", }, ], @@ -101,7 +103,7 @@ {"src": "src/dir/dir_app.py", "dest": "source/dir/apps/"}, [ { - "local": Path("output") / "source" / "dir" / "apps" / "dir_app.py", + "local": deploy_root / "source" / "dir" / "apps" / "dir_app.py", "stage": "/source/dir/apps", } ], @@ -179,43 +181,63 @@ def test_deploy_with_artifacts( ( "src", [ - {"local": "output/src/app.py", "stage": "/src"}, - {"local": "output/src/dir/dir_app.py", "stage": "/src/dir"}, + {"local": deploy_root / "src" / "app.py", "stage": "/src"}, + { + "local": deploy_root / "src" / "dir" / "dir_app.py", + "stage": "/src/dir", + }, ], ), ( "src/", [ - {"local": "output/src/app.py", "stage": "/src"}, - {"local": "output/src/dir/dir_app.py", "stage": "/src/dir"}, + {"local": deploy_root / "src" / "app.py", "stage": "/src"}, + { + "local": deploy_root / "src" / "dir" / "dir_app.py", + "stage": "/src/dir", + }, ], ), ( "src/*", [ - {"local": "output/src/app.py", "stage": "/src"}, - {"local": "output/src/dir/dir_app.py", "stage": "/src/dir"}, + {"local": deploy_root / "src" / "app.py", "stage": "/src"}, + { + "local": deploy_root / "src" / "dir" / "dir_app.py", + "stage": "/src/dir", + }, ], ), - ("src/*.py", [{"local": "output/src/app.py", "stage": "/src"}]), + ("src/*.py", [{"local": deploy_root / "src" / "app.py", "stage": "/src"}]), ( "src/dir/dir_app.py", - [{"local": "output/src/dir/dir_app.py", "stage": "/src/dir"}], + [ + { + "local": deploy_root / "src" / "dir" / "dir_app.py", + "stage": "/src/dir", + } + ], ), ( {"src": "src/**/*", "dest": "source/"}, [ - {"local": "output/source/app.py", "stage": "/source"}, - {"local": "output/source/dir_app.py", "stage": "/source"}, - {"local": "output/source/dir/dir_app.py", "stage": "/source/dir"}, + {"local": deploy_root / "source" / "app.py", "stage": "/source"}, + {"local": deploy_root / "source" / "dir_app.py", "stage": "/source"}, + { + "local": deploy_root / "source" / "dir" / "dir_app.py", + "stage": "/source/dir", + }, ], ), ( {"src": "src", "dest": "source/"}, [ - {"local": "output/source/src/app.py", "stage": "/source/src"}, { - "local": "output/source/src/dir/dir_app.py", + "local": deploy_root / "source" / "src" / "app.py", + "stage": "/source/src", + }, + { + "local": deploy_root / "source" / "src" / "dir" / "dir_app.py", "stage": "/source/src/dir", }, ], @@ -223,9 +245,12 @@ def test_deploy_with_artifacts( ( {"src": "src/", "dest": "source/"}, [ - {"local": "output/source/src/app.py", "stage": "/source/src"}, { - "local": "output/source/src/dir/dir_app.py", + "local": deploy_root / "source" / "src" / "app.py", + "stage": "/source/src", + }, + { + "local": deploy_root / "source" / "src" / "dir" / "dir_app.py", "stage": "/source/src/dir", }, ], @@ -233,15 +258,18 @@ def test_deploy_with_artifacts( ( {"src": "src/*", "dest": "source/"}, [ - {"local": "output/source/app.py", "stage": "/source"}, - {"local": "output/source/dir/dir_app.py", "stage": "/source/dir"}, + {"local": deploy_root / "source" / "app.py", "stage": "/source"}, + { + "local": deploy_root / "source" / "dir" / "dir_app.py", + "stage": "/source/dir", + }, ], ), ( {"src": "src/dir/dir_app.py", "dest": "source/dir/apps/"}, [ { - "local": "output/source/dir/apps/dir_app.py", + "local": deploy_root / "source" / "dir" / "apps" / "dir_app.py", "stage": "/source/dir/apps", } ], diff --git a/tests/streamlit/test_commands.py b/tests/streamlit/test_commands.py index c6ab40afc0..baa01224d1 100644 --- a/tests/streamlit/test_commands.py +++ b/tests/streamlit/test_commands.py @@ -57,7 +57,7 @@ def test_describe_streamlit(mock_connector, runner, mock_ctx): def _put_query(project_root: Path, source: str, dest: str): return dedent( - f"put file://{project_root.resolve() / 'output' / source} {dest} auto_compress=false parallel=4 overwrite=True" + f"put file://{project_root.resolve() / 'output' / 'deploy' / 'streamlit' / source} {dest} auto_compress=false parallel=4 overwrite=True" )