code: def test_custom_pid_file_is_used_in_start_and_stop(
      self,
      mock_setup_locations,
      mock_process,
      mock_celery_app,
      mock_read_pid_from_pidfile,
      mock_remove_existing_pidfile,
  ):
      pid_file = "custom_test_pid_file"
      mock_setup_locations.return_value = (pid_file, None, None, None)
      # Call worker
      worker_args = self.parser.parse_args(
          ["celery", "worker", "--skip-serve-logs", "--pid", pid_file]
      )
      celery_command.worker(worker_args)
      assert mock_celery_app.worker_main.call_args
      args, _ = mock_celery_app.worker_main.call_args
      args_str = " ".join(map(str, args[0]))
      assert f"--pidfile {pid_file}" in args_str
  
      stop_args = self.parser.parse_args(
          ["celery", "stop", "--pid", pid_file]
      )
      celery_command.stop_worker(stop_args)
  
      mock_read_pid_from_pidfile.assert_called_once_with(pid_file)
      mock_process.return_value.terminate.assert_called()
      mock_remove_existing_pidfile.assert_called_once_with(pid_file)
  
imports: from __future__ import annotations
  import importlib
  import os
  from argparse import Namespace
  from unittest import mock
  import pytest
  import sqlalchemy
  import airflow
  from airflow.cli import cli_parser
  from airflow.cli.commands import celery_command
  from airflow.configuration import conf
  from tests.test_utils.config import conf_vars
label_desc: Use image node_id 4 for calling the TestCeleryStopCommand obj's underlying member method code with example usage: obj.test_custom_pid_file_is_used_in_start_and_stop(mock_setup_locations, mock_process, mock_celery_app, mock_read_pid_from_pidfile, mock_remove_existing_pidfile) without return types