class_docstr: shared state for setting up/tearing down test items or collectors. 
class_docstr_tok: ["shared","state","for","setting","up\/tearing","down","test","items","or","collectors","."]
docstr: setup objects along the collector chain to the test-method
  and teardown previously setup objects.
docstr_tok: ["setup","objects","along","the","collector","chain","to","the","test-method","and","teardown","previously","setup","objects","."]
code: def prepare(self, colitem):
      """setup objects along the collector chain to the test-method
      and teardown previously setup objects."""
      needed_collectors = colitem.listchain()
      self._teardown_towards(needed_collectors)
  
      # check if the last collection node has raised an error
      for col in self.stack:
          if hasattr(col, "_prepare_exc"):
              six.reraise(*col._prepare_exc)
      for col in needed_collectors[len(self.stack) :]:
          self.stack.append(col)
          try:
              col.setup()
          except TEST_OUTCOME:
              col._prepare_exc = sys.exc_info()
              raise
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import bdb
  import os
  import sys
  from time import time
  import attr
  import six
  from .reports import CollectErrorRepr
  from .reports import CollectReport
  from .reports import TestReport
  from _pytest._code.code import ExceptionInfo
  from _pytest.compat import safe_str
  from _pytest.outcomes import Exit
  from _pytest.outcomes import Skipped
  from _pytest.outcomes import TEST_OUTCOME
label_desc: Use image node_id 9 for calling the SetupState obj's underlying member method code with example usage: obj.prepare(colitem) without return types