How to use the gabbi.exception.GabbiSyntaxWarning function in gabbi

To help you get started, we’ve selected a few gabbi examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cdent / gabbi / gabbi / driver.py View on Github external
all_test_base_name = None

    # Initialize response and content handlers. This is effectively
    # duplication of effort but not results. This allows for
    # backwards compatibility for existing callers.
    response_handlers = response_handlers or []
    content_handlers = content_handlers or []
    handler_objects = []
    for handler in (content_handlers + response_handlers +
                    handlers.RESPONSE_HANDLERS):
        handler_objects.append(handler())

    top_suite = suite.TestSuite()
    for test_file in glob.iglob('%s/*.yaml' % path):
        if '_' in os.path.basename(test_file):
            warnings.warn(exception.GabbiSyntaxWarning(
                "'_' in test filename %s. This can break suite grouping."
                % test_file))
        if intercept:
            host = str(uuid.uuid4())
        suite_dict = utils.load_yaml(yaml_file=test_file,
                                     safe=safe_yaml)
        test_base_name = os.path.splitext(os.path.basename(test_file))[0]
        if all_test_base_name:
            test_base_name = '%s_%s' % (all_test_base_name, test_base_name)

        if require_ssl:
            if 'defaults' in suite_dict:
                suite_dict['defaults']['ssl'] = True
            else:
                suite_dict['defaults'] = {'ssl': True}