Ejemplo n.º 1
0
    def get_config_obj(suite_path):
        """Get the suite config object in the given file."""
        explicit_suite = ExplicitSuiteConfig.get_config_obj(suite_path)
        matrix_suite = MatrixSuiteConfig.get_config_obj(suite_path)

        if not (explicit_suite or matrix_suite):
            raise errors.SuiteNotFound("Unknown suite '%s'" % suite_path)

        if explicit_suite and matrix_suite:
            raise errors.DuplicateSuiteDefinition(
                "Multiple definitions for suite '%s'" % suite_path)

        return matrix_suite or explicit_suite
def _get_yaml_config(kind, pathname):
    # Named executors or suites are specified as the basename of the file, without the .yml
    # extension.
    if not utils.is_yaml_file(pathname) and not os.path.dirname(pathname):
        if pathname not in _config.NAMED_SUITES:  # pylint: disable=unsupported-membership-test
            raise errors.SuiteNotFound("Unknown %s '%s'" % (kind, pathname))
        # Expand 'pathname' to full path.
        pathname = _config.NAMED_SUITES[pathname]  # pylint: disable=unsubscriptable-object

    if not utils.is_yaml_file(pathname) or not os.path.isfile(pathname):
        raise optparse.OptionValueError(
            "Expected a %s YAML config, but got '%s'" % (kind, pathname))
    return utils.load_yaml_file(pathname)