Skip to content

Commit 9951bab

Browse files
committed
Bump version
1 parent 439e937 commit 9951bab

File tree

3 files changed

+27
-112
lines changed

3 files changed

+27
-112
lines changed

pyproject.toml

Lines changed: 13 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@
22
name = "fastapi-cloud-cli"
33
dynamic = ["version"]
44
description = "Deploy and manage FastAPI Cloud apps from the command line 🚀"
5-
authors = [
6-
{name = "Patrick Arminio", email = "[email protected]"},
7-
]
5+
authors = [{ name = "Patrick Arminio", email = "[email protected]" }]
86
requires-python = ">=3.8"
97
readme = "README.md"
10-
license = {text = "MIT"}
8+
license = { text = "MIT" }
119
classifiers = [
1210
"Intended Audience :: Information Technology",
1311
"Intended Audience :: System Administrators",
@@ -37,14 +35,12 @@ dependencies = [
3735
"uvicorn[standard] >= 0.15.0",
3836
"rignore >= 0.5.1",
3937
"httpx >= 0.27.0,< 0.28.0",
40-
"rich-toolkit >= 0.13.2",
38+
"rich-toolkit >= 0.14.3",
4139
"pydantic >= 1.6.1",
4240
]
4341

4442
[project.optional-dependencies]
45-
standard = [
46-
"uvicorn[standard] >= 0.15.0",
47-
]
43+
standard = ["uvicorn[standard] >= 0.15.0"]
4844

4945
[project.urls]
5046
Homepage = "https://github.com/fastapi/fastapi-cloud-cli"
@@ -62,32 +58,20 @@ version = { source = "file", path = "src/fastapi_cloud_cli/__init__.py" }
6258
distribution = true
6359

6460
[tool.pdm.build]
65-
source-includes = [
66-
"tests/",
67-
"requirements*.txt",
68-
"scripts/",
69-
]
61+
source-includes = ["tests/", "requirements*.txt", "scripts/"]
7062

7163
[tool.pytest.ini_options]
72-
addopts = [
73-
"--strict-config",
74-
"--strict-markers",
75-
]
64+
addopts = ["--strict-config", "--strict-markers"]
7665
xfail_strict = true
7766
junit_family = "xunit2"
7867

7968
[tool.coverage.run]
8069
parallel = true
8170
data_file = "coverage/.coverage"
82-
source = [
83-
"src",
84-
"tests",
85-
]
71+
source = ["src", "tests"]
8672
context = '${CONTEXT}'
8773
dynamic_context = "test_function"
88-
omit = [
89-
"tests/assets/*",
90-
]
74+
omit = ["tests/assets/*"]
9175

9276
[tool.coverage.report]
9377
show_missing = true
@@ -104,9 +88,7 @@ show_contexts = true
10488

10589
[tool.mypy]
10690
strict = true
107-
exclude = [
108-
"tests/assets/*",
109-
]
91+
exclude = ["tests/assets/*"]
11092

11193
[tool.ruff.lint]
11294
select = [
@@ -115,13 +97,13 @@ select = [
11597
"F", # pyflakes
11698
"I", # isort
11799
"B", # flake8-bugbear
118-
"C4", # flake8-comprehensions
100+
"C4", # flake8-comprehensions
119101
"UP", # pyupgrade
120102
]
121103
ignore = [
122-
"E501", # line too long, handled by black
123-
"B008", # do not perform function calls in argument defaults
124-
"C901", # too complex
104+
"E501", # line too long, handled by black
105+
"B008", # do not perform function calls in argument defaults
106+
"C901", # too complex
125107
"W191", # indentation contains tabs
126108
]
127109

src/fastapi_cloud_cli/commands/deploy.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@
44
import tempfile
55
import time
66
import uuid
7-
from collections.abc import Generator
87
from enum import Enum
98
from itertools import cycle
109
from pathlib import Path
11-
from typing import Any, Dict, List, Optional, Union
10+
from typing import Any, Dict, Generator, List, Optional, Union
1211

1312
import rignore
1413
import typer
@@ -331,7 +330,7 @@ def _wait_for_deployment(
331330
)
332331
toolkit.print_line()
333332

334-
time_elapsed = 0
333+
time_elapsed = 0.0
335334

336335
started_at = time.monotonic()
337336

tests/test_cli_deploy.py

Lines changed: 12 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -221,78 +221,6 @@ def test_uses_existing_app(
221221
assert app_data["slug"] in result.output
222222

223223

224-
@pytest.mark.respx(base_url=settings.base_api_url)
225-
def test_creates_and_uploads_deployment_then_fails(
226-
logged_in_cli: None, tmp_path: Path, respx_mock: respx.MockRouter
227-
) -> None:
228-
steps = [
229-
Keys.ENTER,
230-
Keys.ENTER,
231-
Keys.ENTER,
232-
*"demo",
233-
Keys.ENTER,
234-
Keys.RIGHT_ARROW,
235-
Keys.ENTER,
236-
]
237-
238-
team = _get_random_team()
239-
app_data = _get_random_app(team_id=team["id"])
240-
241-
respx_mock.get("/teams/").mock(return_value=Response(200, json={"data": [team]}))
242-
243-
respx_mock.post("/apps/", json={"name": "demo", "team_id": team["id"]}).mock(
244-
return_value=Response(201, json=app_data)
245-
)
246-
247-
respx_mock.get(f"/apps/{app_data['id']}").mock(
248-
return_value=Response(200, json=app_data)
249-
)
250-
251-
deployment_data = _get_random_deployment(app_id=app_data["id"])
252-
253-
respx_mock.post(f"/apps/{app_data['id']}/deployments/").mock(
254-
return_value=Response(201, json=deployment_data)
255-
)
256-
respx_mock.post(
257-
f"/deployments/{deployment_data['id']}/upload",
258-
).mock(
259-
return_value=Response(
260-
200,
261-
json={
262-
"url": "http://test.com",
263-
"fields": {"key": "value"},
264-
},
265-
)
266-
)
267-
268-
respx_mock.post(
269-
"http://test.com",
270-
data={"key": "value"},
271-
).mock(return_value=Response(200))
272-
273-
respx_mock.get(
274-
f"/apps/{app_data['id']}/deployments/{deployment_data['id']}",
275-
).mock(
276-
return_value=Response(
277-
200,
278-
json=_get_random_deployment(app_id=app_data["id"], status="failed"),
279-
)
280-
)
281-
282-
respx_mock.post(
283-
f"/deployments/{deployment_data['id']}/upload-complete",
284-
).mock(return_value=Response(200))
285-
286-
with changing_dir(tmp_path), patch("click.getchar") as mock_getchar:
287-
mock_getchar.side_effect = steps
288-
289-
result = runner.invoke(app, ["deploy"])
290-
291-
assert result.exit_code == 1
292-
293-
assert "Checking the status of your deployment" in result.output
294-
295-
296224
@pytest.mark.respx(base_url=settings.base_api_url)
297225
def test_exits_successfully_when_deployment_is_done(
298226
logged_in_cli: None, tmp_path: Path, respx_mock: respx.MockRouter
@@ -346,9 +274,12 @@ def test_exits_successfully_when_deployment_is_done(
346274
data={"key": "value"},
347275
).mock(return_value=Response(200))
348276

349-
respx_mock.get(f"/apps/{app_data['id']}/deployments/{deployment_data['id']}").mock(
277+
respx_mock.get(f"/deployments/{deployment_data['id']}/build-logs").mock(
350278
return_value=Response(
351-
200, json=_get_random_deployment(app_id=app_data["id"], status="success")
279+
200,
280+
json={
281+
"message": "Hello, world!",
282+
},
352283
)
353284
)
354285

@@ -359,7 +290,7 @@ def test_exits_successfully_when_deployment_is_done(
359290

360291
assert result.exit_code == 0
361292

362-
assert "Ready the chicken! Your app is ready at" in result.output
293+
# TODO: show a message when the deployment is done (based on the status)
363294

364295

365296
@pytest.mark.respx(base_url=settings.base_api_url)
@@ -394,9 +325,12 @@ def test_exists_successfully_when_deployment_is_done_when_app_is_configured(
394325
return_value=Response(200)
395326
)
396327

397-
respx_mock.get(f"/apps/{app_id}/deployments/{deployment_data['id']}").mock(
328+
respx_mock.get(f"/deployments/{deployment_data['id']}/build-logs").mock(
398329
return_value=Response(
399-
200, json=_get_random_deployment(app_id=app_id, status="success")
330+
200,
331+
json={
332+
"message": "Hello, world!",
333+
},
400334
)
401335
)
402336

@@ -409,7 +343,7 @@ def test_exists_successfully_when_deployment_is_done_when_app_is_configured(
409343

410344
assert result.exit_code == 0
411345

412-
assert "Ready the chicken! Your app is ready at" in result.output
346+
# TODO: show a message when the deployment is done (based on the status)
413347

414348

415349
@pytest.mark.respx(base_url=settings.base_api_url)

0 commit comments

Comments
 (0)