cleanup: drop redundant @pytest.mark.asyncio + fix log_id type
- pyproject already sets asyncio_mode=auto, so async def tests are collected as async automatically. Removed the redundant decorator from four files (test_i18n, test_llm_csv_parser, test_ticker_validate, test_localization_integration); the bare async def is enough. - StrategicLogTranslation.log_id used the _PK autoincrement type for a non-PK FK column. Replaced with a portable BigInteger that emits Integer on SQLite and BigInteger elsewhere — matches the migration's sa.BigInteger() declaration. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
b47c45e218
commit
308878749f
5 changed files with 3 additions and 33 deletions
|
|
@ -55,7 +55,6 @@ def test_strategic_log_translation_model_columns():
|
|||
assert cols["content_md"].nullable is False
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_log_translation_fanout_no_active_non_en_users(tmp_path, monkeypatch):
|
||||
"""When no users have an active non-en lang, the fan-out makes no
|
||||
translation calls and no rows are inserted."""
|
||||
|
|
@ -93,7 +92,6 @@ async def test_log_translation_fanout_no_active_non_en_users(tmp_path, monkeypat
|
|||
assert rows == []
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_log_translation_fanout_italian_user(tmp_path, monkeypatch):
|
||||
"""One user at lang=it triggers one translation; the row lands with
|
||||
the right lang and log_id."""
|
||||
|
|
@ -141,7 +139,6 @@ async def test_log_translation_fanout_italian_user(tmp_path, monkeypatch):
|
|||
assert row.llm_cost_usd == pytest.approx(0.00002)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_log_translation_fanout_per_language_failure_isolated(tmp_path, monkeypatch):
|
||||
"""If one language's translation fails, the others (if any) still land
|
||||
and the job does not raise."""
|
||||
|
|
@ -178,7 +175,6 @@ async def test_log_translation_fanout_per_language_failure_isolated(tmp_path, mo
|
|||
assert rows == []
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_analyse_threads_lang_into_system_prompt(tmp_path, monkeypatch):
|
||||
"""When lang='it', the system prompt sent to call_llm contains
|
||||
'Respond in Italian.' — the LLM does the rest."""
|
||||
|
|
@ -217,7 +213,6 @@ async def test_analyse_threads_lang_into_system_prompt(tmp_path, monkeypatch):
|
|||
assert "Respond in Italian" in system
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_analyse_no_clause_when_lang_is_en(tmp_path, monkeypatch):
|
||||
from app.services import portfolio_analysis as pa
|
||||
from app.services.openrouter import LogResult
|
||||
|
|
@ -252,7 +247,6 @@ async def test_analyse_no_clause_when_lang_is_en(tmp_path, monkeypatch):
|
|||
assert "Respond in" not in system
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_digest_translates_variants_per_active_lang(monkeypatch):
|
||||
"""After English variants are built, the job translates each to every
|
||||
active non-en lang. The result is an in-memory mapping the send loop
|
||||
|
|
@ -294,7 +288,6 @@ async def test_digest_translates_variants_per_active_lang(monkeypatch):
|
|||
assert table[("INTERMEDIATE", "it")].startswith("[IT] ")
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_digest_translation_failure_falls_back_to_english(monkeypatch):
|
||||
"""When translate() fails for a (tone, lang) cell, the table entry
|
||||
for that cell is the English variant of the same tone — the user
|
||||
|
|
@ -334,7 +327,6 @@ def test_digest_pick_variant_uses_user_lang():
|
|||
assert ed._pick_variant(table, tone="UNKNOWN", lang="en") == "intermediate en"
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_log_endpoint_serves_italian_when_user_is_italian(tmp_path):
|
||||
"""When a user with lang='it' opens /log, the served content is the
|
||||
Italian translation, not the English original."""
|
||||
|
|
@ -370,7 +362,6 @@ async def test_log_endpoint_serves_italian_when_user_is_italian(tmp_path):
|
|||
assert "Open" not in content
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_log_endpoint_falls_back_to_english_when_no_translation(tmp_path):
|
||||
"""User lang='it' but no IT translation exists → English fallback."""
|
||||
from app.db import utcnow
|
||||
|
|
@ -397,7 +388,6 @@ async def test_log_endpoint_falls_back_to_english_when_no_translation(tmp_path):
|
|||
assert "Open" in content
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_patch_language_accepts_active(tmp_path):
|
||||
"""PATCH /api/settings/language accepts 'en' and 'it' and persists."""
|
||||
from app.models import User
|
||||
|
|
@ -428,7 +418,6 @@ async def test_patch_language_accepts_active(tmp_path):
|
|||
assert user.lang == "it"
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_patch_language_rejects_wip(tmp_path):
|
||||
"""PATCH rejects 'es'/'fr'/'de'/'xx' with 400 — ACTIVE_LANGUAGES gate."""
|
||||
from fastapi import HTTPException
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue