How to use the flexmock.FlexmockContainer.reset function in flexmock

To help you get started, we’ve selected a few flexmock examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github has207 / flexmock / flexmock.py View on Github external
if _isclass(obj):
      classes.append(obj)
  for obj in instances + classes:
    for attr in UPDATED_ATTRS:
      try:
        obj_dict = obj.__dict__
        if _get_code(obj_dict[attr]) is _get_code(Mock.__dict__[attr]):
          del obj_dict[attr]
      except:
        try:
          if _get_code(getattr(obj, attr)) is _get_code(Mock.__dict__[attr]):
            delattr(obj, attr)
        except AttributeError:
          pass
  FlexmockContainer.teardown_properties()
  FlexmockContainer.reset()

  # make sure this is done last to keep exceptions here from breaking
  # any of the previous steps that cleanup all the changes
  for mock_object, expectations in saved.items():
    for expectation in expectations:
      _getattr(expectation, 'verify')()