Ejemplo n.º 1
0
  def __call__(self, info):
    """
      Save the dic info and call _gen_tree.
      The resulting tree is then stored in the
      info dic with the key 'TestTree'
    """


    self.max_cat = 5
    self.info = info
    root = TestTree(0, '', 'Total')
    total = 0
    
    tmp_path = os.getcwd()

    # Visit each path to find tests
    for path in self.info['test_path']:
      if path in info['blacklist']:
        continue
        os.chdir(tmp_path)
      path = os.path.expanduser(path)
      try:
        os.chdir(path)
      except:
        continue
      for f in os.listdir(os.getcwd()):
        if os.path.isdir(f) and self._is_dir_valid(f):
          try:
            os.chdir(f)
          except:
            continue
          tmp = self._gen_tree(1)
          if tmp.total:
            if len(tmp.cat) > self.max_cat:
              self.max_cat = len(tmp.cat)
            root.subcat.append(tmp)
            total += tmp.total
          os.chdir('../')

    root.total = total
    self.info['TestTree'] = root
    self.info['max_cat_len'] = self.max_cat

    return self.info
Ejemplo n.º 2
0
    def __call__(self, info):
        """
      Save the dic info and call _gen_tree.
      The resulting tree is then stored in the
      info dic with the key 'TestTree'
    """

        self.max_cat = 5
        self.info = info
        root = TestTree(0, '', 'Total')
        total = 0

        tmp_path = os.getcwd()

        # Visit each path to find tests
        for path in self.info['test_path']:
            if path in info['blacklist']:
                continue
                os.chdir(tmp_path)
            path = os.path.expanduser(path)
            try:
                os.chdir(path)
            except:
                continue
            for f in os.listdir(os.getcwd()):
                if os.path.isdir(f) and self._is_dir_valid(f):
                    try:
                        os.chdir(f)
                    except:
                        continue
                    tmp = self._gen_tree(1)
                    if tmp.total:
                        if len(tmp.cat) > self.max_cat:
                            self.max_cat = len(tmp.cat)
                        root.subcat.append(tmp)
                        total += tmp.total
                    os.chdir('../')

        root.total = total
        self.info['TestTree'] = root
        self.info['max_cat_len'] = self.max_cat

        return self.info