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: Undo previous changes.  This call consumes the
  undo stack. Calling it a second time has no effect unless
  you do more monkeypatching after the undo call.
  
  There is generally no need to call `undo()`, since it is
  called automatically during tear-down.
  
  Note that the same `monkeypatch` fixture is used across a
  single test function invocation. If `monkeypatch` is used both by
  the test function itself and one of the test fixtures,
  calling `undo()` will undo all of the changes made in
  both functions.
docstr_tok: ["Undo","previous","changes",".","This","call","consumes","the","undo","stack",".","Calling","it","a","second","time","has","no","effect","unless","you","do","more","monkeypatching","after","the","undo","call",".","There","is","generally","no","need","to","call","`","undo","(",")","`",",","since","it","is","called","automatically","during","tear-down",".","Note","that","the","same","`","monkeypatch","`","fixture","is","used","across","a","single","test","function","invocation",".","If","`","monkeypatch","`","is","used","both","by","the","test","function","itself","and","one","of","the","test","fixtures",",","calling","`","undo","(",")","`","will","undo","all","of","the","changes","made","in","both","functions","."]
code: def undo(self):
      """Undo previous changes.  This call consumes the
      undo stack. Calling it a second time has no effect unless
      you do more monkeypatching after the undo call.
  
      There is generally no need to call `undo()`, since it is
      called automatically during tear-down.
  
      Note that the same `monkeypatch` fixture is used across a
      single test function invocation. If `monkeypatch` is used both by
      the test function itself and one of the test fixtures,
      calling `undo()` will undo all of the changes made in
      both functions.
      """
      for obj, name, value in reversed(self._setattr):
          if value is not notset:
              setattr(obj, name, value)
          else:
              delattr(obj, name)
      self._setattr[:] = []
      for dictionary, name, value in reversed(self._setitem):
          if value is notset:
              try:
                  del dictionary[name]
              except KeyError:
                  pass  # was already deleted, so we have the desired state
          else:
              dictionary[name] = value
      self._setitem[:] = []
      if self._savesyspath is not None:
          sys.path[:] = self._savesyspath
          self._savesyspath = None
  
      if self._cwd is not None:
          os.chdir(self._cwd)
          self._cwd = None
  
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 12 for calling the MonkeyPatch obj's underlying member method code with example usage: obj.undo() without return types