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
|
|
@ -9,6 +9,7 @@ from sqlalchemy.ext.asyncio import AsyncSession
|
|||
|
||||
from app.api.runtime_deps import get_scholar_source
|
||||
from app.main import app
|
||||
from app.services.scholar.rate_limit import reset_scholar_rate_limit_state_for_tests
|
||||
from app.services.scholar.source import FetchResult
|
||||
from app.settings import settings
|
||||
from tests.integration.helpers import (
|
||||
|
|
@ -141,6 +142,7 @@ async def test_api_scholars_search_and_profile_image_management(
|
|||
assert candidate["scholar_id"] == "abcDEF123456"
|
||||
assert candidate["profile_image_url"] == "https://scholar.google.com/citations/images/avatar_scholar_256.png"
|
||||
|
||||
reset_scholar_rate_limit_state_for_tests()
|
||||
create_response = client.post(
|
||||
"/api/v1/scholars",
|
||||
json={
|
||||
|
|
|
|||
|
|
@ -76,6 +76,9 @@ class FixtureScholarSource:
|
|||
async def fetch_profile_html(self, scholar_id: str) -> FetchResult:
|
||||
return await self.fetch_profile_page_html(scholar_id, cstart=0, pagesize=100)
|
||||
|
||||
async def fetch_author_search_html(self, query: str, *, start: int = 0) -> FetchResult:
|
||||
raise NotImplementedError
|
||||
|
||||
|
||||
@pytest.mark.integration
|
||||
@pytest.mark.db
|
||||
|
|
|
|||
|
|
@ -33,6 +33,9 @@ class _PassthroughSource:
|
|||
async def fetch_profile_page_html(self, scholar_id: str, *, cstart: int, pagesize: int) -> FetchResult:
|
||||
return await self.fetch_profile_html(scholar_id)
|
||||
|
||||
async def fetch_author_search_html(self, query: str, *, start: int = 0) -> FetchResult:
|
||||
raise NotImplementedError
|
||||
|
||||
|
||||
def _csrf_headers(client: TestClient) -> dict[str, str]:
|
||||
response = client.get("/api/v1/auth/me")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue