import types


def NonSkippingExtFunctestBuilder(method, func):
  """Alternate implementation of dulwich.tests.utils.ext_functest_builder.

  Dulwich skips extension tests for missing C extensions, but we need them in
  google3. This implementation fails fast if the C extensions are not found.

  Args:
    method: The method to run.
    func: The function implementation to pass to method.

  Returns:
    A test method to run the given C extension function.
  """

  def DoTest(self):
    self.assertTrue(isinstance(func, types.BuiltinFunctionType),
                    'C extension for %s not found' % func.__name__)
    method(self, func)

  return DoTest