534bb94eea
Test Migrations / Migrations (SQLite) (push) Has been cancelled
Build Dev Image / build-dev-image (push) Has been cancelled
Check i18n Keys / Check i18n Key Consistency (push) Has been cancelled
Lint / Ruff Lint & Format (push) Has been cancelled
Lint / Frontend Lint (push) Has been cancelled
Test Migrations / Migrations (PostgreSQL) (push) Has been cancelled
29 lines
841 B
Python
29 lines
841 B
Python
from __future__ import annotations
|
|
|
|
import pytest
|
|
|
|
|
|
def dedupe_preregistered_groups() -> None:
|
|
"""Keep API integration route registration isolated across test modules."""
|
|
from langbot.pkg.api.http.controller import group
|
|
|
|
seen: set[tuple[str, str]] = set()
|
|
unique_groups = []
|
|
for group_cls in group.preregistered_groups:
|
|
key = (group_cls.name, group_cls.path)
|
|
if key in seen:
|
|
continue
|
|
seen.add(key)
|
|
unique_groups.append(group_cls)
|
|
|
|
group.preregistered_groups[:] = unique_groups
|
|
|
|
|
|
@pytest.fixture(scope='module')
|
|
def http_controller_cls(mock_circular_import_chain):
|
|
"""Import HTTPController under each module's circular-import isolation."""
|
|
from langbot.pkg.api.http.controller.main import HTTPController
|
|
|
|
dedupe_preregistered_groups()
|
|
return HTTPController
|