code: def test_queue(tmp_dir, dvc, scm, mocker):
      """Patches experiments celery queue for pytest testing.
  
      Uses function-scoped celery worker which runs in separate thread(s).
      """
      import celery
  
      queue = dvc.experiments.celery_queue
      mocker.patch.object(queue, "_spawn_worker")
  
      f = partial(
          _thread_worker,
          queue.celery,
          concurrency=1,
          ping_task_timeout=20,
      )
      exc = None
      for _ in range(3):
          try:
              with f() as worker:
                  mocker.patch.object(
                      queue, "worker", return_value=worker
                  )
                  yield queue
                  return
          except celery.exceptions.TimeoutError as e:
              exc = e
              continue
      assert exc
      raise exc
  
file_path: dvc/tests/unit/repo/experiments/conftest.py
imports: from functools import partial
  import pytest
  from dvc_task.app import FSApp
label_desc: Use image node_id 7 for calling a global function with example usage: test_queue(tmp_dir, dvc, scm, mocker) without return types