Apply ruff 0.16 and black fixes

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012U7coQfVu8nK2R4q2mCULA
This commit is contained in:
Alex Garcia 2026-08-31 13:18:48 -07:00
commit 52e410cd63
3 changed files with 18 additions and 22 deletions

View file

@ -147,9 +147,7 @@ async def test_launch_waits_for_every_startup_hook_before_running_any_task():
assert hook_call_order == ["A", "B"]
handles = ds._background_tasks.tasks()
await asyncio.wait_for(
asyncio.gather(*[h.task for h in handles]), timeout=5
)
await asyncio.wait_for(asyncio.gather(*[h.task for h in handles]), timeout=5)
# Yet by the time task-a's own body executed (after launch, which
# only happens once every startup hook - including B's - has
# finished), task-b was already registered.

View file

@ -64,20 +64,20 @@ def test_serve_with_get_does_not_launch_background_tasks(tmp_path_factory):
sentinel = plugins_dir / "sentinel.txt"
(plugins_dir / "bg_task_for_get.py").write_text(
textwrap.dedent(
"""
f"""
from datasette import hookimpl
@hookimpl
def startup(datasette):
async def inner():
async def task(datasette):
with open("{sentinel}", "w") as fp:
with open("{sentinel!s}", "w") as fp:
fp.write("ran")
datasette.add_background_task(task, name="get-sentinel-task")
return inner
""".format(sentinel=str(sentinel)),
""",
),
"utf-8",
)
@ -96,9 +96,9 @@ def test_serve_with_get_does_not_launch_background_tasks(tmp_path_factory):
assert result.exit_code == 0, result.output
assert not sentinel.exists()
to_unregister = [
to_unregister = next(
p for p in pm.get_plugins() if p.__name__ == "bg_task_for_get.py"
][0]
)
pm.unregister(to_unregister)