Ejemplo n.º 1
0
    def _gen_tree(self, level):
        """
      Method that will parse subdirectories to find all files
      and build a TestTree with it
    """
        # Get path prefix and category name
        prefix = os.getcwd()
        cat_name = os.path.basename(prefix)

        # Create a new node
        cat = TestTree(level, prefix, cat_name)
        cat.info = self._readInfo()

        # Call the prelude function
        prelude_cat(cat.info)

        # Visit files and subdir
        for f in os.listdir(prefix):
            # Parse subdir and maj test_list
            if os.path.isdir(f) and self._is_dir_valid(f):
                try:
                    os.chdir(f)
                except:
                    continue
                tmp = self._gen_tree(level + 1)
                if tmp.total:
                    cat.subcat.append(tmp)
                    cat.total += tmp.total
                os.chdir('../')
            elif self._is_file_valid(f):
                cat.tests.append(Test(prefix, f))

        cat.total += len(cat.tests)

        return cat
Ejemplo n.º 2
0
  def _gen_tree(self, level):
    """
      Method that will parse subdirectories to find all files
      and build a TestTree with it
    """
    # Get path prefix and category name
    prefix = os.getcwd()
    cat_name = os.path.basename(prefix)

    # Create a new node
    cat = TestTree(level, prefix, cat_name)
    cat.info = self._readInfo()

    # Call the prelude function
    prelude_cat(cat.info)


    # Visit files and subdir
    for f in os.listdir(prefix):
      # Parse subdir and maj test_list
      if os.path.isdir(f) and self._is_dir_valid(f):
        try:
          os.chdir(f)
        except:
          continue
        tmp = self._gen_tree(level + 1)
        if tmp.total:
          cat.subcat.append(tmp)
          cat.total += tmp.total
        os.chdir('../')
      elif self._is_file_valid(f):
        cat.tests.append(Test(prefix, f))

    cat.total += len(cat.tests)

    return cat