class_docstr: Context manager to mock a system command.
  
  The mock command will be written to a directory at the front of $PATH,
  taking precedence over any existing command with the same name.
  
  The *python* parameter accepts a string of code for the command to run,
  in addition to the default behaviour of recording calls to the command.
  This will run with the same Python interpreter as the calling code, but in
  a new process.
  
  The *content* parameter gives extra control, by providing a script which
  will run with no additions. On Unix, it should start with a shebang (e.g.
  ``#!/usr/bin/env python``) specifying the interpreter. On Windows, it will
  always be run by the same Python interpreter as the calling code.
  Calls to the command will not be recorded when content is specified.
class_docstr_tok: ["Context","manager","to","mock","a","system","command",".","The","mock","command","will","be","written","to","a","directory","at","the","front","of","$","PATH",",","taking","precedence","over","any","existing","command","with","the","same","name",".","The","*","python","*","parameter","accepts","a","string","of","code","for","the","command","to","run",",","in","addition","to","the","default","behaviour","of","recording","calls","to","the","command",".","This","will","run","with","the","same","Python","interpreter","as","the","calling","code",",","but","in","a","new","process",".","The","*","content","*","parameter","gives","extra","control",",","by","providing","a","script","which","will","run","with","no","additions",".","On","Unix",",","it","should","start","with","a","shebang","(","e.g",".","``","#","!","\/usr\/bin\/env","python","``",")","specifying","the","interpreter",".","On","Windows",",","it","will","always","be","run","by","the","same","Python","interpreter","as","the","calling","code",".","Calls","to","the","command","will","not","be","recorded","when","content","is","specified","."]
code: def _cmd_path(self):
      # Can only be used once commands_dir has been set
      p = os.path.join(self.command_dir, self.name)
      if os.name == "nt":
          p += "-script.py"
      return p
  
file_path: catboost/contrib/python/testpath/py3/testpath/commands.py
imports: import contextlib
  import json
  import os
  import shutil
  import sys
  import tempfile
label_desc: Use image node_id 4 for calling the MockCommand obj's underlying member method code with example usage: obj._cmd_path() and returns: p