Say when a run finished and when a failure happened
`fluksio status` listed recent runs and recent failures with no time on them, so a red line said nothing about whether it was from a minute ago or last week. Both carry an age now, spelled the way a duration is, and the runs listing gained one too. The fields were already on the wire. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019Hra4ndWMCLU5F3KjUuVAc
This commit is contained in:
@@ -520,6 +520,24 @@ def test_two_files_of_one_name_are_refused(tmp_path) -> None:
|
||||
_import(*_module_of(second), second)
|
||||
|
||||
|
||||
def test_how_long_ago_reads_like_a_duration() -> None:
|
||||
"""A failure with no time on it says nothing about whether it is current."""
|
||||
from datetime import UTC, datetime, timedelta
|
||||
|
||||
from fluksio.sdk.cli import _ago
|
||||
|
||||
def then(**delta):
|
||||
return (datetime.now(UTC) - timedelta(**delta)).isoformat()
|
||||
|
||||
assert _ago(then(seconds=5)) == "5s ago"
|
||||
assert _ago(then(minutes=3)) == "3min ago"
|
||||
assert _ago(then(hours=2)) == "2h ago"
|
||||
assert _ago(then(days=3)) == "3d ago"
|
||||
# What the engine stores is UTC whether or not the spelling says so.
|
||||
assert _ago(datetime.now(UTC).replace(tzinfo=None).isoformat()) == "0s ago"
|
||||
assert _ago(None) == ""
|
||||
|
||||
|
||||
def test_a_serve_limit_is_refused_as_a_flag_not_as_a_traceback(capsys) -> None:
|
||||
"""These are written into the environment before the settings are built."""
|
||||
import pytest
|
||||
|
||||
Reference in New Issue
Block a user