Skip to content

Commit 9478194

Browse files
committed
Better logcontext names in tests
1 parent 6be53d8 commit 9478194

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

tests/util/test_async_helpers.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -292,24 +292,26 @@ async def test_logcontext_is_not_lost_when_awaiting_on_timeout_cancellation(
292292
incomplete_d: Deferred = Deferred()
293293

294294
async def competing_task() -> None:
295-
with LoggingContext(name="one", server_name="test_server") as context_one:
295+
with LoggingContext(
296+
name="competing", server_name="test_server"
297+
) as context_competing:
296298
timing_out_d = timeout_deferred(
297299
deferred=incomplete_d,
298300
timeout=1.0,
299301
clock=self.clock,
300302
)
301303
self.assertNoResult(timing_out_d)
302304
# We should still be in the logcontext we started in
303-
self.assertIs(current_context(), context_one)
305+
self.assertIs(current_context(), context_competing)
304306

305307
# Mimic the normal use case to wait for the work to complete or timeout.
306308
#
307-
# We expect the deferred to timeout and raise an exception at this
308-
# point.
309+
# In this specific test, we expect the deferred to timeout and raise an
310+
# exception at this point.
309311
await make_deferred_yieldable(timing_out_d)
310312

311313
# We're still in the same logcontext
312-
self.assertIs(current_context(), context_one)
314+
self.assertIs(current_context(), context_competing)
313315

314316
d = defer.ensureDeferred(competing_task())
315317

0 commit comments

Comments
 (0)