def __new__(mcs, cls, bases, attrs):

    def make_test(fname):
      fpath = osp.join(mcs.dpath, fname)
      module = osp.splitext(fname)[0]

      def test(self):
        try:
          load_source(module, fpath)
        except __HOLE__:
          # Unmet dependency.
          raise SkipTest

      test.__name__ = 'test_%s' % (module, )
      test.__doc__ = 'Test for example %s.' % (fpath, )
      return test

    for fname in os.listdir(mcs.dpath):
      if osp.splitext(fname)[1] == '.py':
        test = make_test(fname)
        attrs[test.__name__] = test
    return super(_ExamplesType, mcs).__new__(mcs, cls, bases, attrs)
dataset/ETHPy150Open mtth/hdfs/test/test_examples.py/_ExamplesType.__new__