mirror of
https://github.com/kennethreitz/kennethreitz.org.git
synced 2026-07-22 01:19:30 +00:00
ea406a22f8
48 tests running in ~8s against an in-process client (api.requests), so broad refactors now have a safety net. The sweep test fetches every URL the sitemap advertises and names any that break. Fixes found while writing them: - Bare-slug legacy redirects failed for YYYY-MM-DD-named essays (the date-strip regex only handled the old YYYY-MM- format) - Search index was only built by background cache warming, so /api/search returned empty results until (or unless) warming finished; it now builds lazily on first use - Sitemap advertised /docs pages that no route serves; removed Also: make test target, pytest config in pyproject. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
21 lines
493 B
Python
21 lines
493 B
Python
"""Shared fixtures: an in-process test client for the whole suite.
|
|
|
|
The app resolves data/ and tuftecms/static/ relative to the repo root,
|
|
so make sure tests run from there regardless of how pytest was invoked.
|
|
"""
|
|
|
|
import os
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
os.chdir(Path(__file__).resolve().parent.parent)
|
|
|
|
from engine import api # noqa: E402
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def client():
|
|
"""Synchronous test client wired straight to the ASGI app."""
|
|
return api.requests
|