test(kevin): fix enum assertion + mark Postgres-dependent tests as integration
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

Pipeline #46 surfaced two pre-existing CI bugs once fakeredis was
installed and tests could collect:

1. test_models.py:389 asserted "DISCOVERED" in status_col.type.enums,
   but the model defines KevinVideoStatus with values_callable so
   .enums returns the lowercase string values, not member names.
   Asserting "discovered" instead.

2. Four test files use the db_session fixture which requires a real
   Postgres on localhost:5432. CI has no Postgres, so 10 tests failed
   with Connect call failed (errno 111). These genuinely need a DB —
   mirroring tests/integration/* which already use
   @pytest.mark.integration. Adding module-level
   pytestmark = pytest.mark.integration to:
   - tests/shared/models/test_meet_kevin_trading.py
   - tests/services/kevin_signal_bridge/test_aggregator.py
   - tests/services/kevin_signal_bridge/test_audit.py
   - tests/services/kevin_signal_bridge/test_exit_scanner.py

CI runs with -m "not integration" so they're now deselected.
Local pytest still picks them up by default (no marker filter).
This commit is contained in:
Viktor Barzin 2026-05-26 20:01:37 +00:00
parent de6f27ddbb
commit bc479802db
5 changed files with 10 additions and 2 deletions

View file

@ -6,6 +6,8 @@ from decimal import Decimal
import pytest
from sqlalchemy.ext.asyncio import AsyncSession
pytestmark = pytest.mark.integration
from services.kevin_signal_bridge.aggregator import MentionAggregator
from shared.models.meet_kevin import (
KevinAnalysis,

View file

@ -7,6 +7,8 @@ import pytest
from sqlalchemy import select
from sqlalchemy.ext.asyncio import AsyncSession
pytestmark = pytest.mark.integration
from services.kevin_signal_bridge.audit import AuditWriter
from shared.models.meet_kevin import (
KevinAnalysis,

View file

@ -7,6 +7,8 @@ from unittest.mock import AsyncMock, MagicMock
import pytest
from sqlalchemy.ext.asyncio import AsyncSession
pytestmark = pytest.mark.integration
from services.kevin_signal_bridge.exit_scanner import ExitScanner
from shared.constants.kevin import KEVIN_STRATEGY_UUID
from shared.models.meet_kevin import (

View file

@ -8,6 +8,8 @@ import pytest
from sqlalchemy import select
from sqlalchemy.ext.asyncio import AsyncSession
pytestmark = pytest.mark.integration
from shared.models.meet_kevin import (
KevinAnalysis,
KevinChannel,

View file

@ -383,10 +383,10 @@ class TestMeetKevinModels:
assert KevinAnalysis.__tablename__ == "kevin_analyses"
assert KevinStockMention.__tablename__ == "kevin_stock_mentions"
# Check that KevinVideo.status is an Enum containing "DISCOVERED"
# SAEnum uses values_callable, so .enums returns lowercase values, not member names.
status_col = KevinVideo.__table__.c.status
assert status_col is not None
assert "DISCOVERED" in status_col.type.enums
assert "discovered" in status_col.type.enums
# Check relationships exist
assert hasattr(KevinChannel, "videos")