Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def repr_failure(self, excinfo): # pylint: disable=no-self-use
""" called when self.runtest() raises an exception.
Todo:
This stuff is copied from pytest at the moment - needs a bit of
modifying so that it shows the yaml and all the reasons the test
failed rather than a traceback
"""
if self.config.getini("tavern-beta-new-traceback") or self.config.getoption(
"tavern_beta_new_traceback"
):
if issubclass(excinfo.type, exceptions.TavernException):
return ReprdError(excinfo, self)
return super(YamlItem, self).repr_failure(excinfo)
"""Some kind of error returned from paho library
"""
class MissingCookieError(TavernException):
"""Tried to use a cookie in a request that was not present in the session
cookie jar
"""
class RestRequestException(TavernException):
"""Error making requests in RestRequest()
"""
class MQTTRequestException(TavernException):
"""Error making requests in MQTTRequest()
"""
class MQTTTLSError(TavernException):
"""Error with TLS arguments to MQTT client"""
class PluginLoadError(TavernException):
"""Error loading a plugin"""
class InvalidExtFunctionError(TavernException):
"""Error loading an external function for validation/plugin use"""
"""Missing key in request specification
"""
class MissingFormatError(TavernException):
"""Tried to use a variable in a format string but it was not in the
available variables
"""
class MissingSettingsError(TavernException):
"""Wanted to send an MQTT message but no settings were given
"""
class MQTTError(TavernException):
"""Some kind of error returned from paho library
"""
class MissingCookieError(TavernException):
"""Tried to use a cookie in a request that was not present in the session
cookie jar
"""
class RestRequestException(TavernException):
"""Error making requests in RestRequest()
"""
class MQTTRequestException(TavernException):
"""Error with TLS arguments to MQTT client"""
class PluginLoadError(TavernException):
"""Error loading a plugin"""
class InvalidExtFunctionError(TavernException):
"""Error loading an external function for validation/plugin use"""
class JMESError(TavernException):
"""Error in JMES matching"""
class InvalidStageReferenceError(TavernException):
"""Error loading stage reference"""
class DuplicateStageDefinitionError(TavernException):
"""Stage with the specified ID previously defined"""
class InvalidSettingsError(TavernException):
"""Configuration was passed incorrectly in some fashion"""
class KeySearchNotFoundError(TavernException):
"""Trying to search for a key in the response but was not found"""
class InvalidQueryResultTypeError(TavernException):
logger.debug(
"Strict key checking for this stage is '%s'", stage_strictness
)
test_block_config["strict"] = stage_strictness
elif default_strictness:
logger.debug(
"Default strictness '%s' ignored for this stage", default_strictness
)
# Wrap run_stage with retry helper
run_stage_with_retries = retry(stage, test_block_config)(run_stage)
try:
run_stage_with_retries(sessions, stage, tavern_box, test_block_config)
except exceptions.TavernException as e:
e.stage = stage
e.test_block_config = test_block_config
raise
if getonly(stage):
break
"""
class MQTTTLSError(TavernException):
"""Error with TLS arguments to MQTT client"""
class PluginLoadError(TavernException):
"""Error loading a plugin"""
class InvalidExtFunctionError(TavernException):
"""Error loading an external function for validation/plugin use"""
class JMESError(TavernException):
"""Error in JMES matching"""
class InvalidStageReferenceError(TavernException):
"""Error loading stage reference"""
class DuplicateStageDefinitionError(TavernException):
"""Stage with the specified ID previously defined"""
class InvalidSettingsError(TavernException):
"""Configuration was passed incorrectly in some fashion"""
class KeySearchNotFoundError(TavernException):
class TavernException(Exception):
"""Base exception
"""
class BadSchemaError(TavernException):
"""Schema mismatch
"""
class TestFailError(TavernException):
"""Test failed somehow
"""
def __init__(self, msg, failures=None):
super(TestFailError, self).__init__(msg)
self.failures = failures or []
class KeyMismatchError(TavernException):
"""Mismatch found while validating keys in response
"""
"""Searched for a value in data but it was not a 'simple' type"""
class UnexpectedDocumentsError(TavernException):
"""Multiple documents were found in a YAML file when only one was expected"""
class DuplicateCookieError(TavernException):
"""User tried to reuse a cookie from a previous request and override it in the same request"""
class InvalidConfigurationException(TavernException):
"""A configuration value (from the cli or the ini file) was invalid"""
class InvalidFormattedJsonError(TavernException):
"""Tried to use the magic json format tag in an invalid way"""
"""Configuration was passed incorrectly in some fashion"""
class KeySearchNotFoundError(TavernException):
"""Trying to search for a key in the response but was not found"""
class InvalidQueryResultTypeError(TavernException):
"""Searched for a value in data but it was not a 'simple' type"""
class UnexpectedDocumentsError(TavernException):
"""Multiple documents were found in a YAML file when only one was expected"""
class DuplicateCookieError(TavernException):
"""User tried to reuse a cookie from a previous request and override it in the same request"""
class InvalidConfigurationException(TavernException):
"""A configuration value (from the cli or the ini file) was invalid"""
class InvalidFormattedJsonError(TavernException):
"""Tried to use the magic json format tag in an invalid way"""
"""Error loading stage reference"""
class DuplicateStageDefinitionError(TavernException):
"""Stage with the specified ID previously defined"""
class InvalidSettingsError(TavernException):
"""Configuration was passed incorrectly in some fashion"""
class KeySearchNotFoundError(TavernException):
"""Trying to search for a key in the response but was not found"""
class InvalidQueryResultTypeError(TavernException):
"""Searched for a value in data but it was not a 'simple' type"""
class UnexpectedDocumentsError(TavernException):
"""Multiple documents were found in a YAML file when only one was expected"""
class DuplicateCookieError(TavernException):
"""User tried to reuse a cookie from a previous request and override it in the same request"""
class InvalidConfigurationException(TavernException):
"""A configuration value (from the cli or the ini file) was invalid"""
class InvalidFormattedJsonError(TavernException):