class_docstr: Object returned by the ``monkeypatch`` fixture keeping a record of setattr/item/env/syspath changes.
      
class_docstr_tok: ["Object","returned","by","the","``","monkeypatch","``","fixture","keeping","a","record","of","setattr\/item\/env\/syspath","changes","."]
docstr: Set attribute value on target, memorizing the old value.
  By default raise AttributeError if the attribute did not exist.
  
  For convenience you can specify a string as ``target`` which
  will be interpreted as a dotted import path, with the last part
  being the attribute name.  Example:
  ``monkeypatch.setattr("os.getcwd", lambda: "/")``
  would set the ``getcwd`` function of the ``os`` module.
  
  The ``raising`` value determines if the setattr should fail
  if the attribute is not already present (defaults to True
  which means it will raise).
docstr_tok: ["Set","attribute","value","on","target",",","memorizing","the","old","value",".","By","default","raise","AttributeError","if","the","attribute","did","not","exist",".","For","convenience","you","can","specify","a","string","as","``","target","``","which","will","be","interpreted","as","a","dotted","import","path",",","with","the","last","part","being","the","attribute","name",".","Example",":","``","monkeypatch.setattr","(","``","os.getcwd","''",",","lambda",":","``","\/","''",")","``","would","set","the","``","getcwd","``","function","of","the","``","os","``","module",".","The","``","raising","``","value","determines","if","the","setattr","should","fail","if","the","attribute","is","not","already","present","(","defaults","to","True","which","means","it","will","raise",")","."]
code: def setattr(self, target, name, value=notset, raising=True):
      """Set attribute value on target, memorizing the old value.
      By default raise AttributeError if the attribute did not exist.
  
      For convenience you can specify a string as ``target`` which
      will be interpreted as a dotted import path, with the last part
      being the attribute name.  Example:
      ``monkeypatch.setattr("os.getcwd", lambda: "/")``
      would set the ``getcwd`` function of the ``os`` module.
  
      The ``raising`` value determines if the setattr should fail
      if the attribute is not already present (defaults to True
      which means it will raise).
      """
      __tracebackhide__ = True
      import inspect
  
      if value is notset:
          if not isinstance(target, six.string_types):
              raise TypeError(
                  "use setattr(target, name, value) or "
                  "setattr(target, value) with target being a dotted "
                  "import string"
              )
          value = name
          name, target = derive_importpath(target, raising)
  
      oldval = getattr(target, name, notset)
      if raising and oldval is notset:
          raise AttributeError(
              "%r has no attribute %r" % (target, name)
          )
  
      # avoid class descriptors like staticmethod/classmethod
      if inspect.isclass(target):
          oldval = target.__dict__.get(name, notset)
      self._setattr.append((target, name, oldval))
      setattr(target, name, value)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  import re
  import sys
  import warnings
  from contextlib import contextmanager
  import six
  import pytest
  from _pytest.fixtures import fixture
  from _pytest.pathlib import Path
label_desc: Use image node_id 3 for calling the MonkeyPatch obj's underlying member method code with example usage: obj.setattr(target, name, value, raising) without return types