Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion truss/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -1493,7 +1493,7 @@ def push(
sys.exit(1)

except RemoteNetworkError:
console.print("Deployment failed: Could not reach remote.", style="red")
console.print("Could not reach remote.", style="red")
sys.exit(1)
elif tail and isinstance(service, BasetenService):
bt_remote = cast(BasetenRemote, remote_provider)
Expand Down
17 changes: 16 additions & 1 deletion truss/tests/test_util.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
from unittest.mock import patch
from pathlib import Path
from unittest.mock import MagicMock, patch

import requests_mock

Expand Down Expand Up @@ -37,3 +38,17 @@ def test_download_into_nested_subdir(tmp_path):
content = f.read()

assert content == mocked_download_content


@patch("truss.util.download.download_from_url_using_requests")
def test_download_with_absolute_path(mock_download_from_url_using_requests, tmp_path):
with patch("pathlib.Path.mkdir", MagicMock()):
data = ExternalData.from_list(
[{"local_data_path": "/foo/bar", "url": TEST_DOWNLOAD_URL}]
)

download_external_data(data, data_dir=tmp_path)

mock_download_from_url_using_requests.assert_called_once_with(
TEST_DOWNLOAD_URL, Path("/foo/bar")
)
4 changes: 0 additions & 4 deletions truss/util/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ def download_external_data(external_data: Optional[ExternalData], data_dir: Path
# ensure parent directories exist
for item in external_data.items:
path = data_dir / item.local_data_path
if data_dir not in path.parents:
raise ValueError(
"Local data path of external data cannot point to outside data directory"
)
path.parent.mkdir(exist_ok=True, parents=True)

if b10cp_path is not None:
Expand Down
Loading