Skip to content

Commit d166877

Browse files
committed
Only warn if size is more than threshold (no warning if exactly at threshold)
1 parent 5a13cc8 commit d166877

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

src/fastapi_cloud_cli/commands/deploy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ def _get_large_files(path: Path, threshold_mb: int) -> list[tuple[Path, int]]:
146146
if filename.is_dir():
147147
continue
148148
file_size = filename.stat().st_size
149-
if file_size >= threshold_bytes:
149+
if file_size > threshold_bytes:
150150
large_files.append((filename.relative_to(path), file_size))
151151

152152
return sorted(large_files, key=lambda x: x[1], reverse=True)

tests/test_cli_deploy.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2220,7 +2220,7 @@ def test_large_file_threshold_warning(
22202220
)
22212221

22222222
_create_file(tmp_path / "model.bin", 12 * 1024 * 1024) # 12 MB
2223-
_create_file(tmp_path / "data.csv", 11 * 1024 * 1024) # 11 MB
2223+
_create_file(tmp_path / "data.csv", 10 * 1024 * 1024 + 1) # 10+ MB
22242224

22252225
with changing_dir(tmp_path):
22262226
result = runner.invoke(app, ["deploy"])
@@ -2230,7 +2230,7 @@ def test_large_file_threshold_warning(
22302230
assert "model.bin" in result.output
22312231
assert "12 MB" in result.output
22322232
assert "data.csv" in result.output
2233-
assert "11 MB" in result.output
2233+
assert "10 MB" in result.output
22342234

22352235

22362236
@pytest.mark.respx
@@ -2279,8 +2279,9 @@ def test_large_file_threshold_does_not_warn_when_no_large_files(
22792279
return_value=Response(200, json={**deployment_data, "status": "success"})
22802280
)
22812281

2282-
# 5 MB file: below the default 10 MB threshold
2282+
# Files are less or equal to 10 MB (default threshold), so no warning should be shown
22832283
_create_file(tmp_path / "data.bin", 5 * 1024 * 1024)
2284+
_create_file(tmp_path / "data.bin", 10 * 1024 * 1024)
22842285

22852286
with changing_dir(tmp_path):
22862287
result = runner.invoke(app, ["deploy"])

0 commit comments

Comments
 (0)