2014-08-27 15:17:06 +00:00
|
|
|
from __future__ import unicode_literals
|
2013-07-27 20:24:38 +00:00
|
|
|
import boto
|
|
|
|
from nose.plugins.skip import SkipTest
|
2015-01-11 21:39:39 +00:00
|
|
|
import six
|
2013-07-27 20:24:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
def version_tuple(v):
|
|
|
|
return tuple(map(int, (v.split("."))))
|
|
|
|
|
|
|
|
|
2017-02-24 02:37:43 +00:00
|
|
|
# Note: See https://github.com/spulec/moto/issues/201 for why this is a
|
|
|
|
# separate method.
|
2014-09-10 19:49:20 +00:00
|
|
|
def skip_test():
|
|
|
|
raise SkipTest
|
|
|
|
|
|
|
|
|
2013-07-27 20:24:38 +00:00
|
|
|
class requires_boto_gte(object):
|
|
|
|
"""Decorator for requiring boto version greater than or equal to 'version'"""
|
2017-02-24 02:37:43 +00:00
|
|
|
|
2013-07-27 20:24:38 +00:00
|
|
|
def __init__(self, version):
|
|
|
|
self.version = version
|
|
|
|
|
|
|
|
def __call__(self, test):
|
|
|
|
boto_version = version_tuple(boto.__version__)
|
|
|
|
required = version_tuple(self.version)
|
|
|
|
if boto_version >= required:
|
2014-01-24 15:45:39 +00:00
|
|
|
return test
|
2014-09-10 19:49:20 +00:00
|
|
|
return skip_test
|
2015-01-11 21:39:39 +00:00
|
|
|
|
|
|
|
|
|
|
|
class disable_on_py3(object):
|
|
|
|
def __call__(self, test):
|
|
|
|
if not six.PY3:
|
|
|
|
return test
|
|
|
|
return skip_test
|