Skip to content

Commit 3685440

Browse files
committed
test(multi): start the stuck bar before the render thread exists
The join_timeout test started its bar inside the multibar context, so a render tick could catch the bar between _started=True and widget population, crash the render thread on the empty-widgets assert, and let join() succeed on a dead thread -- skipping the timeout path the test exists to exercise (seen as a reproducible 99.93% coverage failure on the py312 CI job). Start the bar fully up front; verified stable across 10 consecutive runs and at 100% coverage on 3.12/3.14.
1 parent 6d9f6dd commit 3685440

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

tests/test_multibar.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,11 +283,17 @@ def test_multibar_join_timeout_abandons_unfinished_bar() -> None:
283283
multibar = progressbar.MultiBar(fd=io.StringIO(), join_timeout=0.1)
284284
bar = progressbar.ProgressBar(max_value=10)
285285
multibar['stuck'] = bar
286+
# Fully start the bar before the render thread exists: started() flips
287+
# true before the widgets are populated, so a render tick during a
288+
# concurrent bar.start() can crash the render thread on the
289+
# empty-widgets assert -- join() then succeeds on a dead thread and the
290+
# timeout path this test exists to exercise is never taken.
291+
bar.start()
292+
bar.update(5) # never reaches max_value / finish()
286293

287294
def exit_context() -> None:
288295
with multibar:
289-
bar.start()
290-
bar.update(5) # never reaches max_value / finish()
296+
pass
291297

292298
thread = threading.Thread(target=exit_context, daemon=True)
293299
thread.start()

0 commit comments

Comments
 (0)