Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# use gabbi to create the test suite from our declaration
suite = test_suite_from_yaml(
unittest.defaultTestLoader,
self.id(),
gabbi_declaration,
'.',
host,
None,
None,
None,
)
# run the test (we store the the output into a custom stream so that hypothesis can display only the simple
# case test result on failure rather than every failing case)
s = StringIO()
result = ConciseTestRunner(stream=s, verbosity=0).run(suite)
# if we weren't successfull we need to fail the test case with the error string from gabbi
if not result.wasSuccessful():
self.fail(s.getvalue())
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()