Polish live runs status layout

This commit is contained in:
Abel Luck 2026-03-31 12:35:41 +02:00
parent ba33491479
commit 73617cd40c
6 changed files with 203 additions and 48 deletions

View file

@ -911,6 +911,45 @@ def test_load_runs_view_humanizes_completed_execution_end_time(
assert completed["ended_at_iso"] == ended_at.isoformat()
def test_load_runs_view_humanizes_running_execution_start_time(
monkeypatch, tmp_path: Path
) -> None:
db_path = tmp_path / "runs-running-view.db"
log_dir = tmp_path / "out" / "logs"
monkeypatch.setenv("REPUBLISHER_DB_PATH", str(db_path))
app = create_app()
app.config["REPUB_LOG_DIR"] = log_dir
source = create_source(
name="Running source",
slug="running-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/running.xml",
)
job = Job.get(Job.source == source)
reference_time = datetime(2026, 1, 15, 12, 0, tzinfo=UTC)
started_at = reference_time - timedelta(hours=2)
JobExecution.create(
job=job,
running_status=JobExecutionStatus.RUNNING,
started_at=started_at,
)
view = load_runs_view(log_dir=app.config["REPUB_LOG_DIR"], now=reference_time)
running = view["running"][0]
assert running["started_at"] == "2 hours ago"
assert running["started_at_iso"] == started_at.isoformat()
def test_render_runs_uses_database_backed_jobs_and_executions(
monkeypatch, tmp_path: Path
) -> None: