def testRmtreeNonExistingDirWithHandler(self):
    class NonLocal: pass
    def error_handler(_, path, error_info):
      NonLocal.errorHandled = True
      NonLocal.errorPath = path

    directory = 'nonexisting'
    NonLocal.errorHandled = False
    NonLocal.errorPath = ''
    try:
      self.shutil.rmtree(directory, onerror=error_handler)
    except IOError:
      self.fail('rmtree raised exception despite onerror defined')
    self.assertTrue(NonLocal.errorHandled)
    self.assertEqual(NonLocal.errorPath, directory)
    
    NonLocal.errorHandled = False
    NonLocal.errorPath = ''
    try:
      self.shutil.rmtree(directory, ignore_errors=True, onerror=error_handler)
    except __HOLE__:
      self.fail('rmtree raised exception despite ignore_errors True')
    # ignore_errors is True, so the onerror() error handler was not executed
    self.assertFalse(NonLocal.errorHandled)
    self.assertEqual(NonLocal.errorPath, '')
dataset/ETHPy150Open jmcgeheeiv/pyfakefs/fake_filesystem_shutil_test.py/FakeShutilModuleTest.testRmtreeNonExistingDirWithHandler