Skip to content

Commit b1fad37

Browse files
Clean up tests
1 parent 55581c8 commit b1fad37

File tree

2 files changed

+2
-9
lines changed

2 files changed

+2
-9
lines changed

src/fastapi_cloud_cli/commands/logs.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,8 @@
1818

1919
logger = logging.getLogger(__name__)
2020

21-
# Maximum number of reconnection attempts before giving up
2221
MAX_RECONNECT_ATTEMPTS = 10
23-
24-
# Delay between reconnection attempts in seconds
2522
RECONNECT_DELAY_SECONDS = 1
26-
27-
# Colors matching the UI log level indicators
2823
LOG_LEVEL_COLORS = {
2924
"debug": "blue",
3025
"info": "cyan",
@@ -111,7 +106,6 @@ def _process_log_stream(
111106
if data.get("type") == "heartbeat": # pragma: no cover
112107
continue
113108

114-
# Handle error messages from the server
115109
if data.get("type") == "error":
116110
toolkit.print(
117111
f"Error: {data.get('message', 'Unknown error')}",
@@ -157,14 +151,13 @@ def _process_log_stream(
157151
# On reconnect, resume from last seen timestamp
158152
# The API uses strict > comparison, so logs with the same timestamp
159153
# as last_timestamp will be filtered out (no duplicates)
160-
if last_timestamp:
154+
if last_timestamp: # pragma: no cover
161155
current_since = last_timestamp.isoformat()
162156
current_tail = 0 # Don't fetch historical logs again
163157

164158
time.sleep(RECONNECT_DELAY_SECONDS)
165159
continue
166160

167-
# Handle non-recoverable errors
168161
if isinstance(e, HTTPStatusError) and e.response.status_code in (401, 403):
169162
toolkit.print(
170163
"The specified token is not valid. Use [blue]`fastapi login`[/] to generate a new token.",

tests/test_logs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ def test_gives_up_after_max_reconnect_attempts(
312312
)
313313

314314
with changing_dir(configured_app.path):
315-
result = runner.invoke(app, ["logs"]) # follow=True by default
315+
result = runner.invoke(app, ["logs"])
316316

317317
assert result.exit_code == 1
318318
assert "Lost connection" in result.output

0 commit comments

Comments
 (0)