docstr: Ensure all_gather has no dependency on torch.distributed when run in single process.
docstr_tok: ["Ensure","all_gather","has","no","dependency","on","torch.distributed","when","run","in","single","process","."]
code: def test_all_gather_result_no_pg(self) -> None:
      """
      Ensure all_gather has no dependency on torch.distributed when run in single process.
      """
      func = mock.MagicMock()
      res = all_gather(data_or_fn=func)
      func.assert_called_once()
  
file_path: pytorch/test/distributed/test_collective_utils.py
imports: from unittest import mock
  import torch.distributed
  from torch.distributed.collective_utils import all_gather, broadcast
  from torch.testing._internal.common_distributed import MultiProcessTestCase
label_desc: Use image node_id 8 for calling the TestCollectiveUtils obj's underlying member method code with example usage: obj.test_all_gather_result_no_pg() without return types