How to use the gabbi.suitemaker 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 / runner.py View on Github external
data['defaults']['ssl'] = True
        else:
            data['defaults'] = {'ssl': True}
    if verbosity:
        if 'defaults' in data:
            data['defaults']['verbose'] = verbosity
        else:
            data['defaults'] = {'verbose': verbosity}
    if not cert_validate:
        if 'defaults' in data:
            data['defaults']['cert_validate'] = False
        else:
            data['defaults'] = {'cert_validate': False}

    loader = unittest.defaultTestLoader
    test_suite = suitemaker.test_suite_from_dict(
        loader, name, data, data_dir, host, port, None, None, prefix=prefix,
        handlers=handler_objects, test_loader_name='gabbi-runner')

    # The default runner stream is stderr.
    stream = sys.stderr
    if quiet:
        # We want to swallow the output that the runner is
        # producing.
        stream = open(os.devnull, 'w')
    result = ConciseTestRunner(
        stream=stream, verbosity=2, failfast=failfast).run(test_suite)
    return result.wasSuccessful()
github cdent / gabbi / gabbi / driver.py View on Github external
def test_suite_from_yaml(loader, test_base_name, test_yaml, test_directory,
                         host, port, fixture_module, intercept, prefix=''):
    """Legacy wrapper retained for backwards compatibility."""

    with warnings.catch_warnings():  # ensures warnings filter is restored
        warnings.simplefilter('default', DeprecationWarning)
        warnings.warn('test_suite_from_yaml has been renamed to '
                      'test_suite_from_dict', DeprecationWarning, stacklevel=2)
    return suitemaker.test_suite_from_dict(
        loader, test_base_name, test_yaml, test_directory, host, port,
        fixture_module, intercept, prefix)
github cdent / gabbi / gabbi / driver.py View on Github external
else:
                suite_dict['defaults'] = {'verbose': verbose}

        if not cert_validate:
            if 'defaults' in suite_dict:
                suite_dict['defaults']['cert_validate'] = False
            else:
                suite_dict['defaults'] = {'cert_validate': False}

        if not use_prior_test:
            if 'defaults' in suite_dict:
                suite_dict['defaults']['use_prior_test'] = use_prior_test
            else:
                suite_dict['defaults'] = {'use_prior_test': use_prior_test}

        file_suite = suitemaker.test_suite_from_dict(
            loader, test_base_name, suite_dict, path, host, port,
            fixture_module, intercept, prefix=prefix,
            test_loader_name=test_loader_name, handlers=handler_objects,
            inner_fixtures=inner_fixtures)
        top_suite.addTest(file_suite)
    return top_suite
github gnocchixyz / gnocchi / gnocchi / tempest / scenario / __init__.py View on Github external
port = 443
            require_ssl = True
        else:
            port = 80
            require_ssl = False
        host = parsed_url.hostname
        if parsed_url.port:
            port = parsed_url.port

        os.environ["GNOCCHI_SERVICE_TOKEN"] = token
        os.environ["GNOCCHI_AUTHORIZATION"] = "not used"

        with open(os.path.join(TEST_DIR, filename)) as f:
            suite_dict = utils.load_yaml(f)
            suite_dict.setdefault('defaults', {})['ssl'] = require_ssl
            test_suite = suitemaker.test_suite_from_dict(
                loader=unittest.defaultTestLoader,
                test_base_name="gabbi",
                suite_dict=suite_dict,
                test_directory=TEST_DIR,
                host=host, port=port,
                fixture_module=None,
                intercept=None,
                prefix=prefix,
                handlers=runner.initialize_handlers([]),
                test_loader_name="tempest")

            # NOTE(sileht): We hide stdout/stderr and reraise the failure
            # manually, tempest will print it itself.
            with open(os.devnull, 'w') as stream:
                result = unittest.TextTestRunner(
                    stream=stream, verbosity=0, failfast=True,