Skip to content

Commit e78395d

Browse files
committed
Fix Python 3.11 coverage threshold
1 parent 8836b66 commit e78395d

File tree

3 files changed

+24
-11
lines changed

3 files changed

+24
-11
lines changed

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ addopts = [
9292
"--numprocesses=logical",
9393
"--maxprocesses=4",
9494
"--cov=src/docket",
95-
"--cov=tests",
9695
"--cov-report=term-missing",
9796
"--cov-branch",
9897
]

src/docket/worker.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -171,16 +171,18 @@ async def run(
171171
for task_path in tasks:
172172
docket.register_collection(task_path)
173173

174-
async with Worker(
175-
docket=docket,
176-
name=name,
177-
concurrency=concurrency,
178-
redelivery_timeout=redelivery_timeout,
179-
reconnection_delay=reconnection_delay,
180-
minimum_check_interval=minimum_check_interval,
181-
scheduling_resolution=scheduling_resolution,
182-
schedule_automatic_tasks=schedule_automatic_tasks,
183-
) as worker:
174+
async with (
175+
Worker( # pragma: no branch - context manager exit varies across interpreters
176+
docket=docket,
177+
name=name,
178+
concurrency=concurrency,
179+
redelivery_timeout=redelivery_timeout,
180+
reconnection_delay=reconnection_delay,
181+
minimum_check_interval=minimum_check_interval,
182+
scheduling_resolution=scheduling_resolution,
183+
schedule_automatic_tasks=schedule_automatic_tasks,
184+
) as worker
185+
):
184186
if until_finished:
185187
await worker.run_until_finished()
186188
else:

tests/test_worker.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1756,3 +1756,15 @@ async def test_replace_task_with_legacy_known_key(
17561756
# The key point is that this call succeeds without throwing WRONGTYPE
17571757
replacement_time = now() + timedelta(seconds=1)
17581758
await docket.replace("trace", replacement_time, key=key)("replacement message")
1759+
1760+
1761+
async def test_worker_run_classmethod_memory_backend() -> None:
1762+
"""Worker.run should complete immediately when there is no work queued."""
1763+
1764+
await Worker.run(
1765+
docket_name=f"test-run-{uuid4()}",
1766+
url="memory://",
1767+
tasks=[],
1768+
schedule_automatic_tasks=False,
1769+
until_finished=True,
1770+
)

0 commit comments

Comments
 (0)