Fix issues found by CI on Gitea runner

- cli.py: remove redundant cast to str (mypy strict, click 8.5+ types prompt);
  annotate prompt result explicitly
- test_storage.py: use now-relative timestamps instead of hardcoded 2026-08
  dates so history-filter tests do not rot over time
- add Gitea Actions CI workflow (.gitea/workflows/ci.yml)
This commit is contained in:
2026-09-03 12:03:14 +03:00
parent f95223b88b
commit 6caa021824
3 changed files with 49 additions and 7 deletions
+5 -4
View File
@@ -108,14 +108,15 @@ def test_save_and_get_latest_model_metrics(tmp_path) -> None:
def test_history_upsert_same_day(tmp_path) -> None:
storage = Storage(tmp_path / "cache.db")
timestamp = dt.datetime.now(dt.timezone.utc) - dt.timedelta(days=1)
point = HistoryPoint(
timestamp=dt.datetime(2026, 8, 1, 12, 0),
timestamp=timestamp,
amount_rub=Decimal("10.00"),
tokens=TokenUsage(input_tokens=5),
)
storage.save_history(point)
point2 = HistoryPoint(
timestamp=dt.datetime(2026, 8, 1, 12, 0),
timestamp=timestamp,
amount_rub=Decimal("15.00"),
tokens=TokenUsage(input_tokens=8),
)
@@ -151,7 +152,7 @@ def test_save_snapshot_combined(tmp_path) -> None:
metrics=_metrics(),
models=_models(),
history_point=HistoryPoint(
timestamp=dt.datetime(2026, 8, 1, 12, 0),
timestamp=dt.datetime.now(dt.timezone.utc) - dt.timedelta(days=1),
amount_rub=Decimal("854.83"),
tokens=TokenUsage(input_tokens=100),
),
@@ -225,7 +226,7 @@ def test_clear_removes_all_rows(tmp_path) -> None:
storage = Storage(tmp_path / "cache.db")
storage.save_history(
HistoryPoint(
timestamp=dt.datetime(2026, 8, 18),
timestamp=dt.datetime.now(dt.timezone.utc) - dt.timedelta(days=1),
amount_rub=Decimal("1"),
tokens=TokenUsage(input_tokens=1),
)