Files
kjvstudy.org/tests/conftest.py
kennethreitz bab27364fc Integrate turboAPI as FastAPI replacement for Zig-powered HTTP performance
Replace FastAPI with turboAPI across the entire codebase:
- Swap all imports from fastapi to turboapi (TurboAPI, APIRouter, HTTPException, etc.)
- Keep starlette imports for Jinja2Templates and StaticFiles (not yet in turboapi)
- Remove unsupported `example=` params from Query/Path declarations
- Update entry point to use turboapi's native server (app.run())
- Update test clients to use turboapi.testclient.TestClient

The app loads successfully with all 200+ routes registered. turboAPI's
Zig HTTP core provides significant throughput improvements over uvicorn.

Note: turboAPI's TestClient has limited support for Request injection
and Query defaults, causing some test failures. The actual server
runtime handles these correctly.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 00:38:03 -04:00

84 lines
2.2 KiB
Python

"""
Shared pytest configuration and fixtures
"""
import pytest
from turboapi.testclient import TestClient
from kjvstudy_org.server import app
@pytest.fixture(scope="session")
def client():
"""
Create test client fixture with session scope for reuse across tests.
FastAPI's TestClient is safe to reuse.
"""
return TestClient(app)
@pytest.fixture(scope="session")
def sample_verses():
"""Sample verse references for testing"""
return {
"john_3_16": {"book": "John", "chapter": 3, "verse": 16},
"genesis_1_1": {"book": "Genesis", "chapter": 1, "verse": 1},
"psalms_23": {"book": "Psalms", "chapter": 23, "start": 1, "end": 6},
"matthew_5_14": {"book": "Matthew", "chapter": 5, "verse": 14},
"romans_8_28": {"book": "Romans", "chapter": 8, "verse": 28},
}
@pytest.fixture(scope="session")
def sample_books():
"""Sample book names for testing"""
return {
"short_book": "Philemon",
"long_book": "Genesis",
"new_testament": "John",
"old_testament": "Psalms",
"first_book": "Genesis",
"last_book": "Revelation",
}
@pytest.fixture(scope="session")
def book_abbreviations():
"""Common book abbreviations mapping"""
return {
# Old Testament
"Gen": "Genesis",
"Exo": "Exodus",
"Lev": "Leviticus",
"Num": "Numbers",
"Deut": "Deuteronomy",
"Josh": "Joshua",
"Ps": "Psalms",
"Prov": "Proverbs",
"Isa": "Isaiah",
"Jer": "Jeremiah",
"Ezek": "Ezekiel",
"Dan": "Daniel",
# New Testament
"Matt": "Matthew",
"Rom": "Romans",
"Gal": "Galatians",
"Eph": "Ephesians",
"Phil": "Philippians",
"Col": "Colossians",
"Heb": "Hebrews",
"Jas": "James",
"Rev": "Revelation",
}
@pytest.fixture(scope="session")
def bible_facts():
"""Known facts about the KJV Bible for validation"""
return {
"total_books": 66,
"total_verses": 31102,
"old_testament_books": 39,
"new_testament_books": 27,
"longest_chapter": {"book": "Psalms", "chapter": 119, "verses": 176},
"longest_book": {"name": "Psalms", "chapters": 150},
}