Skip to content

Commit

Permalink
Fixed error message in artifact logic (#1700)
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-bdufour authored Oct 10, 2024
1 parent 6421ff2 commit 1d45ee3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 1 addition & 3 deletions src/snowflake/cli/_plugins/nativeapp/artifacts.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,7 @@ def _update_dest_is_dir(self, dest: Path, is_dir: bool) -> None:

current_is_dir = self._dest_is_dir.get(dest, None)
if current_is_dir is not None and current_is_dir != is_dir:
raise ArtifactError(
"Conflicting type for destination path: {canonical_dest}"
)
raise ArtifactError(f"Conflicting type for destination path: {dest}")

parent = dest.parent
if parent != dest:
Expand Down
8 changes: 6 additions & 2 deletions tests/nativeapp/test_artifacts.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,13 +444,17 @@ def test_bundle_map_handles_missing_dest(bundle_map):

def test_bundle_map_disallows_mapping_files_as_directories(bundle_map):
bundle_map.add(PathMapping(src="app", dest="deployed/"))
with pytest.raises(ArtifactError):
with pytest.raises(
ArtifactError, match="Conflicting type for destination path: deployed"
):
bundle_map.add(PathMapping(src="**/main.py", dest="deployed"))


def test_bundle_map_disallows_mapping_directories_as_files(bundle_map):
bundle_map.add(PathMapping(src="**/main.py", dest="deployed"))
with pytest.raises(ArtifactError):
with pytest.raises(
ArtifactError, match="Conflicting type for destination path: deployed"
):
bundle_map.add(PathMapping(src="app", dest="deployed"))


Expand Down

0 comments on commit 1d45ee3

Please sign in to comment.