Exemplo 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
Exemplo 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
Exemplo n.º 3
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
Exemplo n.º 4
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
Exemplo n.º 5
0
 def get_app_nodes(self):
     return [
         x.anode for x in TestTree(self.app.a11y_app_name).get_node_list()
     ]
Exemplo n.º 6
0
 def test_sequences(self, anode=None, parent=None):
     tree = TestTree(self.app.a11y_app_name, anode, parent=parent)
     return tree.test_sequences()