Пример #1
0
def cmd_report(cfg):
    """
    Report build and/or test results using the specified "reporter". Currently
    results can be reported by e-mail or printed to stdout.

    Args:
        cfg:    A dictionary of skt configuration.
    """
    if not cfg.get("reporter"):
        return

    # Attempt to import the reporter provided by the user
    try:
        module = importlib.import_module('skt.reporter')
        class_name = "{}Reporter".format(cfg['reporter']['type'].title())
        reporter_class = getattr(module, class_name)
    except AttributeError:
        sys.exit(
            "Unable to find specified reporter type: {}".format(class_name))

    # FIXME We are passing the entire cfg object to the reporter class but
    # we should be passing the specific options that are needed.
    # Create a report
    reporter = reporter_class(cfg)
    reporter.report()
Пример #2
0
def cmd_report(cfg):
    if cfg.get("reporter") == None:
        return

    cfg['reporter'][1].update({'cfg': cfg})
    reporter = skt.reporter.getreporter(*cfg.get('reporter'))
    reporter.report()
Пример #3
0
def cmd_report(cfg):
    """
    Report build and/or test results using the specified "reporter". Currently
    results can be reported by e-mail or printed to stdout.

    Args:
        cfg:    A dictionary of skt configuration.
    """
    if not cfg.get("reporter"):
        return

    # FIXME This is violation of composition. This basically passes the whole
    # configuration object to reporter, so it can access anything. Pass the
    # needed data explicitly instead, or deal with it outside reporter, if
    # that is unsuitable.
    cfg['reporter'][1].update({'cfg': cfg})
    reporter = skt.reporter.getreporter(*cfg.get('reporter'))
    reporter.report()