Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_aborts_on_incompatible_version_requirement(self):
self.config['require_version'] = '<0'
with pytest.raises(VersionIncompatibleError):
self.config._check_version()
def test_aborts_on_incompatible_version_requirement(self):
config = {
'required_version': '<0'
}
with pytest.raises(VersionIncompatibleError):
ConfigReader(self.context)._check_version(config)
def _check_version(self, config):
"""
Raises a VersionIncompatibleException when the current Sceptre version
does not comply with the configured version requirement.
:raises: sceptre.exceptions.VersionIncompatibleException
"""
sceptre_version = __version__
if 'required_version' in config:
required_version = config['required_version']
if Version(sceptre_version) not in SpecifierSet(required_version, True):
raise VersionIncompatibleError(
"Current sceptre version ({0}) does not meet version "
"requirements: {1}".format(
sceptre_version, required_version
)
def _check_version(self):
"""
Raises a VersionIncompatibleException when the current sceptre version
does not comply with the configured version requirement.
:raises: sceptre.exceptions.VersionIncompatibleException
"""
sceptre_version = __version__
if self.name == 'config' and 'require_version' in self:
require_version = self['require_version']
if Version(sceptre_version) not in SpecifierSet(require_version):
raise VersionIncompatibleError(
"Current sceptre version ({0}) does not meet version "
"requirements: {1}".format(
sceptre_version, require_version
)