Упрощение для балбесов
Some checks failed
CI / Lint (ruff + mypy) (push) Failing after 35s
CI / Run tests (push) Has been skipped
CI / Docker build test (push) Successful in 18s

This commit is contained in:
2026-03-30 18:26:49 +07:00
parent bdae79db58
commit ea4a6fbe38
6 changed files with 548 additions and 452 deletions

View File

@@ -46,12 +46,12 @@ async def test_build_digest_aggregates_projects(monkeypatch):
text = await digest_builder.build_digest()
assert "новых issues: 1" in text
assert "новых групп проблем: 1" in text
assert "regressions: 1" in text
assert "unresolved > 7 дней: 1" in text
assert "старых групп > 7 дней: 1" in text
assert "backend-production" in text
assert "Old frontend issue" in text
assert "2026.03.20" in text
assert "12 событий" in text
@pytest.mark.asyncio
@@ -94,7 +94,8 @@ async def test_build_today_summary_limits_to_today(monkeypatch):
text = await digest_builder.build_today_summary()
assert "Сегодня: 1 новых issues" in text
assert "Сегодня: 1 групп проблем" in text
assert "событий за сегодня: 2" in text
assert "Today issue" in text
assert "Old issue" not in text
@@ -127,7 +128,7 @@ async def test_build_project_summary(monkeypatch):
assert "backend-production" in text
assert "Project issue" in text
assert "5 событий" in text
assert "всего событий: 5" in text
@pytest.mark.asyncio
@@ -219,9 +220,61 @@ async def test_build_release_summary_and_detail(monkeypatch):
detail = await digest_builder.build_release_detail("2026.03.27")
assert "2026.03.27" in summary
assert "2 issues" in summary
assert "2 групп" in summary
assert "Release issue" in detail
@pytest.mark.asyncio
async def test_build_today_summary_groups_similar_titles(monkeypatch):
now = datetime.now(UTC)
issues = [
IssueSnapshot(
1,
"backend-production",
(
"2026-03-30 10:59:52.605 | ERROR | logging:callHandlers:1762 - "
"The garbage collector is trying to clean up"
),
None,
"error",
"unresolved",
now - timedelta(hours=2),
now - timedelta(minutes=5),
1,
False,
None,
None,
),
IssueSnapshot(
2,
"backend-production",
(
"2026-03-30 09:59:26.932 | ERROR | logging:callHandlers:1762 - "
"The garbage collector is trying to clean up"
),
None,
"error",
"unresolved",
now - timedelta(hours=1),
now,
1,
False,
None,
None,
),
]
monkeypatch.setattr(
digest_builder, "_load_issues", lambda *args, **kwargs: _async_value(issues)
)
text = await digest_builder.build_today_summary()
assert "Сегодня: 1 групп проблем" in text
assert "событий за сегодня: 2" in text
assert "2 повторов" in text
assert "The garbage collector is trying to clean up" in text
async def _async_value(value):
return value