code: def mocked_slurm() -> tp.Iterator[test_core.MockedSubprocess]:
      mock = test_core.MockedSubprocess(known_cmds=["srun"])
      try:
          with mock.context():
              yield mock
      finally:
          # Clear the state of the shared watcher
          slurm.SlurmJob.watcher.clear()
  
imports: import contextlib
  import os
  import signal
  import subprocess
  import typing
  from pathlib import Path
  from unittest.mock import patch
  import pytest
  import submitit
  from ..None import helpers
  from ..core import job_environment, submission, test_core, utils
  from ..core.core import Job
  from .None import slurm
label_desc: Use image node_id 2 for calling a global function with example usage: mocked_slurm() without return types