add try catch for missing package in old boto versions

This commit is contained in:
Sorin 2014-01-07 12:59:36 +02:00
parent 637fef1302
commit 6277f72c07
3 changed files with 23 additions and 15 deletions

View File

@ -1,12 +1,14 @@
import boto
import sure # noqa
import requests
import boto.dynamodb2
from moto import mock_dynamodb2
from moto.dynamodb2 import dynamodb_backend2
from boto.exception import JSONResponseError
from tests.helpers import requires_boto_gte
try:
import boto.dynamodb2
except ImportError:
print "This boto version is not supported"
@requires_boto_gte("2.9")
@mock_dynamodb2

View File

@ -2,16 +2,19 @@ import boto
import sure # noqa
from freezegun import freeze_time
from moto import mock_dynamodb2
from boto.dynamodb2.fields import HashKey
from boto.dynamodb2.fields import RangeKey
from boto.dynamodb2.table import Table
from boto.dynamodb2.table import Item
from boto.dynamodb.exceptions import DynamoDBKeyNotFoundError
from boto.dynamodb2.exceptions import ValidationException
from boto.dynamodb2.exceptions import ConditionalCheckFailedException
from boto.exception import JSONResponseError
from tests.helpers import requires_boto_gte
try:
from boto.dynamodb2.fields import HashKey
from boto.dynamodb2.fields import RangeKey
from boto.dynamodb2.table import Table
from boto.dynamodb2.table import Item
from boto.dynamodb.exceptions import DynamoDBKeyNotFoundError
from boto.dynamodb2.exceptions import ValidationException
from boto.dynamodb2.exceptions import ConditionalCheckFailedException
except ImportError:
print "This boto version is not supported"
def create_table():
table = Table.create('messages', schema=[
HashKey('forum_name'),

View File

@ -3,12 +3,15 @@ import sure # noqa
from freezegun import freeze_time
from boto.exception import JSONResponseError
from moto import mock_dynamodb2
from boto.dynamodb2.fields import HashKey
from boto.dynamodb2.fields import RangeKey
from boto.dynamodb2.table import Table
from boto.dynamodb2.table import Item
from tests.helpers import requires_boto_gte
try:
from boto.dynamodb2.fields import HashKey
from boto.dynamodb2.fields import RangeKey
from boto.dynamodb2.table import Table
from boto.dynamodb2.table import Item
except ImportError:
print "This boto version is not supported"
def create_table():
table = Table.create('messages', schema=[
HashKey('forum_name')