class_docstr: Test venv module installation of pip.
class_docstr_tok: ["Test","venv","module","installation","of","pip","."]
docstr: Capture output from a failed subprocess for easier debugging.
  
  The output this handler produces can be a little hard to read,
  but at least it has all the details.
docstr_tok: ["Capture","output","from","a","failed","subprocess","for","easier","debugging",".","The","output","this","handler","produces","can","be","a","little","hard","to","read",",","but","at","least","it","has","all","the","details","."]
code: def nicer_error(self):
      """
      Capture output from a failed subprocess for easier debugging.
  
      The output this handler produces can be a little hard to read,
      but at least it has all the details.
      """
      try:
          yield
      except subprocess.CalledProcessError as exc:
          out = (exc.output or b"").decode(errors="replace")
          err = (exc.stderr or b"").decode(errors="replace")
          self.fail(
              f"{exc}\n\n"
              f"**Subprocess Output**\n{out}\n\n"
              f"**Subprocess Error**\n{err}"
          )
  
imports: import contextlib
  import ensurepip
  import os
  import os.path
  import pathlib
  import re
  import shutil
  import struct
  import subprocess
  import sys
  import sysconfig
  import tempfile
  from test.support import captured_stdout, captured_stderr, skip_if_broken_multiprocessing_synchronize, verbose, requires_subprocess, is_emscripten, is_wasi, requires_venv_with_pip, TEST_HOME_DIR, requires_resource, copy_python_src_ignore
  from test.support.os_helper import can_symlink, EnvironmentVarGuard, rmtree
  import unittest
  import venv
  from unittest.mock import patch, Mock
label_desc: Use image node_id 6 for calling the EnsurePipTest obj's underlying member method code with example usage: obj.nicer_error() without return types