Esempio n. 1
0
 def test_load_suites_with_missing_plugin_implementation_should_log_warning(
         self, mockImport):
     mockImport.return_value.goodguy = mock.PropertyMock(
         side_effect=AttributeError('this is just a mirage'))
     load_suites(['so.close.to:goodguy'], disableDefaults=True)
     self.log.warning.assert_called_once_with(
         'Skipping missing plugin implementation "%s" within plugin "%s"',
         'goodguy', 'so.close.to')
Esempio n. 2
0
 def test_load_suites_should_load_default_suites(self):
     load_suites([])
     self.assertEqual(2, len(QualitySuite.available_suites()))
Esempio n. 3
0
 def test_load_suites_with_missing_plugin_module_should_log_warning(self, mockImport):
     mockImport.side_effect = ImportError('that is really not there')
     load_suites(['this.one:isright'], disableDefaults=True)
     self.log.warning.assert_called_once_with('Skipping missing plugin module "%s"', 'this.one')
Esempio n. 4
0
 def test_load_suites_with_malformed_plugin_should_log_warning(self):
     load_suites(['nocolonhere'], disableDefaults=True)
     self.log.warning.assert_called_once_with('Skipping malformed plugin specifier "%s"', 'nocolonhere')
Esempio n. 5
0
"""@ingroup vigilance
@file
Contains the console API for Vigilance.
"""
import click
import six
import yaml

from voluptuous import Schema, Required, ALLOW_EXTRA
from voluptuous.error import Invalid
from vigilance.error import ConfigurationParsingError, UnknownSuite, ReportParsingError
from vigilance.plugin import get_configured_plugins, load_suites
from vigilance.suite import QualitySuite

load_suites(get_configured_plugins())

ConfigurationSchema = Schema({Required('suites'): {str:
                                                   Schema({Required('report'): str,
                                                           Required('constraints'):
                                                           Schema([Schema({Required('type'): str}, extra=ALLOW_EXTRA)])})}})

@click.command(short_help='Verify code coverage metrics against a set of constraints')
@click.option('--config', 'configFile', type=click.File(), default='vigilance.yaml', help='Path to the vigilance configuration file')
def main(configFile): #pylint: disable=missing-docstring, invalid-name
    """Runs Vigilance with the specified configuration file.
    The default configuration file if no options are passed is vigilance.yaml within the current working directory.
    """
    try:
        suites = ConfigurationSchema(yaml.full_load(configFile))['suites']
    except yaml.YAMLError:
        raise ConfigurationParsingError('Could not load configuration file as yaml')