code: def test_text_progressbar(capsys, client):
      futures = client.map(inc, range(10))
      p = TextProgressBar(
          futures, interval=0.01, complete=True, loop=client.loop
      )
      client.gather(futures)
  
      start = time()
      while p.status != "finished":
          sleep(0.01)
          assert time() - start < 5
  
      check_bar_completed(capsys)
      assert p._last_response == {
          "all": 10,
          "remaining": 0,
          "status": "finished",
      }
      assert p.comm.closed()
  
file_path: distributed/distributed/diagnostics/tests/test_progressbar.py
imports: from __future__ import annotations
  from time import sleep
  import pytest
  from tornado.ioloop import IOLoop
  from distributed.diagnostics.progressbar import TextProgressBar, progress
  from distributed.metrics import time
  from distributed.utils_test import div, gen_cluster, inc
label_desc: Use image node_id 1 for calling a global function with example usage: test_text_progressbar(capsys, client) without return types