class_docstr: Example runner.
  
  A single runner can run multiple script commands.
  A runner creates a temporary directory and files in the respective example
  directory are copied there.
  All the runs are executed within the temporary directory as the current
  directory.
class_docstr_tok: ["Example","runner",".","A","single","runner","can","run","multiple","script","commands",".","A","runner","creates","a","temporary","directory","and","files","in","the","respective","example","directory","are","copied","there",".","All","the","runs","are","executed","within","the","temporary","directory","as","the","current","directory","."]
code: def __enter__(self):
      contexts = []
  
      # Create a temporary directory.
      tempd = tempdir()
      work_dir = tempd.__enter__()
      contexts.append(tempd)
  
      # Change the current directory.
      chdir_ = chdir(work_dir)
      chdir_.__enter__()
      contexts.append(chdir_)
  
      self.work_dir = work_dir
      self.contexts = contexts
  
      # Initialize the work directory.
      self._init_work_dir()
      return self
  
imports: import contextlib
  import os
  import re
  import shutil
  import subprocess
  import sys
  import tempfile
label_desc: Use image node_id 2 for calling the ExampleRunner obj's underlying member method code with example usage: obj.__enter__() and returns: self