Exemplo n.º 1
0
Arquivo: base.py Projeto: rasibley/tmt
 def lint(self):
     """ Check plan against the L2 metadata specification. """
     self.ls()
     execute = self.node.get('execute')
     echo(verdict(execute is not None, 'execute step must be defined'))
     if self.summary is None:
         echo(verdict(2, 'summary is very useful for quick inspection'))
     elif len(self.summary) > 50:
         echo(verdict(2, 'summary should not exceed 50 characters'))
Exemplo n.º 2
0
Arquivo: base.py Projeto: rasibley/tmt
 def lint(self):
     """ Check test against the L1 metadata specification. """
     self.ls()
     echo(verdict(self.test is not None, 'test script must be defined'))
     echo(verdict(self.path is not None, 'directory path must be defined'))
     if self.summary is None:
         echo(verdict(2, 'summary is very useful for quick inspection'))
     elif len(self.summary) > 50:
         echo(verdict(2, 'summary should not exceed 50 characters'))
Exemplo n.º 3
0
Arquivo: base.py Projeto: jscotka/tmt
 def coverage(self, code, test, docs):
     """ Show story coverage """
     if code:
         code = bool(self.implemented)
         echo(verdict(code, good='done', bad='todo') + ' ', nl=False)
     if test:
         test = bool(self.tested)
         echo(verdict(test, good='done', bad='todo') + ' ', nl=False)
     if docs:
         docs = bool(self.documented)
         echo(verdict(docs, good='done', bad='todo') + ' ', nl=False)
     echo(self)
     return (code, test, docs)
Exemplo n.º 4
0
Arquivo: base.py Projeto: jscotka/tmt
    def lint(self):
        """
        Check test against the L1 metadata specification.

        Return whether the test is valid.
        """
        self.ls()
        valid = self.test is not None and self.path is not None

        # Check test, path and summary
        echo(verdict(self.test is not None, 'test script must be defined'))
        echo(verdict(self.path is not None, 'directory path must be defined'))
        if self.summary is None:
            echo(verdict(2, 'summary is very useful for quick inspection'))
        elif len(self.summary) > 50:
            echo(verdict(2, 'summary should not exceed 50 characters'))

        # Check for possible test case relevancy rules
        filename = self.node.sources[-1]
        metadata = tmt.utils.yaml_to_dict(self.read(filename))
        relevancy = metadata.pop('relevancy', None)
        if relevancy:
            # Convert into adjust rules if --fix enabled
            if self.opt('fix'):
                metadata['adjust'] = tmt.convert.relevancy_to_adjust(relevancy)
                self.write(filename, tmt.utils.dict_to_yaml(metadata))
                echo(verdict(2, 'relevancy converted into adjust'))
            else:
                echo(verdict(0, 'relevancy has been obsoleted by adjust'))
                valid = False

        return valid