Refine runs table state layout

This commit is contained in:
Abel Luck 2026-03-31 12:25:46 +02:00
parent db1d9b44b7
commit ba33491479
6 changed files with 241 additions and 31 deletions

View file

@ -49,6 +49,40 @@ def test_load_runs_view_humanizes_completed_execution_summary_bytes(
assert view["completed"][0]["stats"] == "14 requests • 11 items • 15.7 MiB"
def test_load_runs_view_projects_completed_execution_duration(
tmp_path: Path,
) -> None:
initialize_database(tmp_path / "jobs-completed-duration.db")
source = create_source(
name="Completed source",
slug="completed-source",
source_type="feed",
notes="",
spider_arguments="",
enabled=False,
cron_minute="*/5",
cron_hour="*",
cron_day_of_month="*",
cron_day_of_week="*",
cron_month="*",
feed_url="https://example.com/completed.xml",
)
job = Job.get(Job.source == source)
JobExecution.create(
job=job,
running_status=JobExecutionStatus.SUCCEEDED,
started_at=datetime(2026, 3, 30, 11, 59, 12, tzinfo=UTC),
ended_at=datetime(2026, 3, 30, 12, 0, tzinfo=UTC),
)
view = load_runs_view(
log_dir=tmp_path / "out" / "logs",
now=datetime(2026, 3, 30, 12, 30, tzinfo=UTC),
)
assert view["completed"][0]["duration"] == "00:00:48"
def test_load_runs_view_humanizes_running_execution_summary_bytes(
tmp_path: Path,
) -> None: