Skip to content

Commit af7a593

Browse files
authored
test: improve mock readability (#28)
1 parent 8f955d5 commit af7a593

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/litmodels/io/cloud.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
from typing import TYPE_CHECKING, List, Optional, Tuple, Union
66

77
from lightning_sdk.lightning_cloud.env import LIGHTNING_CLOUD_URL
8-
from lightning_sdk.models import download_model, upload_model
8+
from lightning_sdk.models import download_model as sdk_download_model
9+
from lightning_sdk.models import upload_model as sdk_upload_model
910

1011
if TYPE_CHECKING:
1112
from lightning_sdk.models import UploadedModelInfo
@@ -71,7 +72,7 @@ def upload_model_files(
7172
verbose: Whether to print a link to the uploaded model. If set to 0, no link will be printed.
7273
7374
"""
74-
info = upload_model(
75+
info = sdk_upload_model(
7576
name=name,
7677
path=path,
7778
progress_bar=progress_bar,
@@ -99,7 +100,7 @@ def download_model_files(
99100
Returns:
100101
The absolute path to the downloaded model file or folder.
101102
"""
102-
return download_model(
103+
return sdk_download_model(
103104
name=name,
104105
download_dir=download_dir,
105106
progress_bar=progress_bar,

tests/test_io_cloud.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def test_wrong_model_name(name):
2323
(Module(), f"%s{os.path.sep}Module.pth", True),
2424
],
2525
)
26-
@mock.patch("litmodels.io.cloud.upload_model")
26+
@mock.patch("litmodels.io.cloud.sdk_upload_model")
2727
def test_upload_model(mock_upload_model, tmpdir, model, model_path, verbose):
2828
mock_upload_model.return_value.name = "org-name/teamspace/model-name"
2929

@@ -44,7 +44,7 @@ def test_upload_model(mock_upload_model, tmpdir, model, model_path, verbose):
4444
)
4545

4646

47-
@mock.patch("litmodels.io.cloud.download_model")
47+
@mock.patch("litmodels.io.cloud.sdk_download_model")
4848
def test_download_model(mock_download_model):
4949
# The lit-logger function is just a wrapper around the SDK function
5050
download_model(

0 commit comments

Comments
 (0)