1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
"""Ensure tests default auth off unless a test patches settings (before config import is too late for that)."""
from __future__ import annotations
import asyncio
import os
import pytest
os.environ.setdefault("PYGITWEB_AUTH", "0")
@pytest.fixture(autouse=True)
def _reset_pygitweb_app_lifecycle_state() -> None:
"""Starlette TestClient lifespan sets shutting_down on exit; httpx ASGITransport never runs lifespan.
Stale state made long-poll tests see ``shutting_down`` and skip ``wait_for_changes``, so notify woke 0 waiters.
"""
from pygitweb.main import app
app.state.shutting_down = False
app.state.shutdown_event = asyncio.Event()
yield