How to use the tavern.util.exceptions.TavernException function in tavern

To help you get started, we’ve selected a few tavern 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 taverntesting / tavern / tavern / testutils / pytesthook.py View on Github external
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)
github taverntesting / tavern / tavern / util / exceptions.py View on Github external
"""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"""
github taverntesting / tavern / tavern / util / exceptions.py View on Github external
"""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):
github taverntesting / tavern / tavern / util / exceptions.py View on Github external
"""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):
github taverntesting / tavern / tavern / core.py View on Github external
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
github taverntesting / tavern / tavern / util / exceptions.py View on Github external
"""


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):
github taverntesting / tavern / tavern / util / exceptions.py View on Github external
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
    """
github taverntesting / tavern / tavern / util / exceptions.py View on Github external
"""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"""
github taverntesting / tavern / tavern / util / exceptions.py View on Github external
"""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"""
github taverntesting / tavern / tavern / util / exceptions.py View on Github external
"""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):