Drop redundant _ds_client global now that ds_client is session-scoped

Session-scoped fixtures are cached per worker by pytest itself, so the
manual _ds_client module global is no longer needed.

Refs #2692

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Simon Willison 2026-04-16 20:41:58 -07:00
commit b3001c1e5a

View file

@ -28,9 +28,6 @@ UNDOCUMENTED_PERMISSIONS = {
"view_document",
}
_ds_client = None
def wait_until_responds(url, timeout=5.0, client=httpx, **kwargs):
start = time.time()
while time.time() - start < timeout:
@ -60,10 +57,6 @@ async def ds_client():
from .fixtures import CONFIG, METADATA, PLUGINS_DIR
import secrets
global _ds_client
if _ds_client is not None:
return _ds_client
ds = Datasette(
metadata=METADATA,
config=CONFIG,
@ -95,8 +88,7 @@ async def ds_client():
await db.execute_write_fn(prepare)
await ds.invoke_startup()
_ds_client = ds.client
return _ds_client
return ds.client
def pytest_report_header(config):