fix: resolve mypy errors, fix arxiv test session isolation, and add premerge script
- Remove unused type:ignore comment in scholars.py - Fix 51 mypy errors across test files (Any return types, cast(), protocol stubs) - Fix arxiv unit test failures caused by session isolation (patch_session_factory fixture) - Fix integration test rate-limit bleed between search and create - Add scripts/premerge.sh for local CI verification - Add docs/website/.docusaurus/ to .gitignore Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
49cf7034b2
commit
87aa89b58c
17 changed files with 129 additions and 28 deletions
17
tests/unit/services/domains/arxiv/conftest.py
Normal file
17
tests/unit/services/domains/arxiv/conftest.py
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
from sqlalchemy.ext.asyncio import AsyncSession, async_sessionmaker
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def patch_session_factory(db_session: AsyncSession, monkeypatch: pytest.MonkeyPatch):
|
||||
"""Patch get_session_factory in arxiv modules to use the test's DB engine.
|
||||
|
||||
Without this, the implementation creates its own engine via get_session_factory()
|
||||
which may not share transaction visibility with the test's db_session fixture.
|
||||
"""
|
||||
factory = async_sessionmaker(db_session.bind, expire_on_commit=False)
|
||||
monkeypatch.setattr("app.services.arxiv.rate_limit.get_session_factory", lambda: factory)
|
||||
monkeypatch.setattr("app.services.arxiv.cache.get_session_factory", lambda: factory)
|
||||
return factory
|
||||
Loading…
Add table
Add a link
Reference in a new issue