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: attach a finalizer to the given colitem.
  if colitem is None, this will add a finalizer that
  is called at the end of teardown_all().
docstr_tok: ["attach","a","finalizer","to","the","given","colitem",".","if","colitem","is","None",",","this","will","add","a","finalizer","that","is","called","at","the","end","of","teardown_all","(",")","."]
code: def addfinalizer(self, finalizer, colitem):
      """attach a finalizer to the given colitem.
      if colitem is None, this will add a finalizer that
      is called at the end of teardown_all().
      """
      assert colitem and not isinstance(colitem, tuple)
      assert callable(finalizer)
      # assert colitem in self.stack  # some unit tests don't setup stack :/
      self._finalizers.setdefault(colitem, []).append(finalizer)
  
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 2 for calling the SetupState obj's underlying member method code with example usage: obj.addfinalizer(finalizer, colitem) without return types