add try catch for missing package in old boto versions
This commit is contained in:
parent
637fef1302
commit
6277f72c07
@ -1,12 +1,14 @@
|
|||||||
import boto
|
import boto
|
||||||
import sure # noqa
|
import sure # noqa
|
||||||
import requests
|
import requests
|
||||||
import boto.dynamodb2
|
|
||||||
from moto import mock_dynamodb2
|
from moto import mock_dynamodb2
|
||||||
from moto.dynamodb2 import dynamodb_backend2
|
from moto.dynamodb2 import dynamodb_backend2
|
||||||
from boto.exception import JSONResponseError
|
from boto.exception import JSONResponseError
|
||||||
from tests.helpers import requires_boto_gte
|
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")
|
@requires_boto_gte("2.9")
|
||||||
@mock_dynamodb2
|
@mock_dynamodb2
|
||||||
|
@ -2,16 +2,19 @@ import boto
|
|||||||
import sure # noqa
|
import sure # noqa
|
||||||
from freezegun import freeze_time
|
from freezegun import freeze_time
|
||||||
from moto import mock_dynamodb2
|
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 boto.exception import JSONResponseError
|
||||||
from tests.helpers import requires_boto_gte
|
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():
|
def create_table():
|
||||||
table = Table.create('messages', schema=[
|
table = Table.create('messages', schema=[
|
||||||
HashKey('forum_name'),
|
HashKey('forum_name'),
|
||||||
|
@ -3,12 +3,15 @@ import sure # noqa
|
|||||||
from freezegun import freeze_time
|
from freezegun import freeze_time
|
||||||
from boto.exception import JSONResponseError
|
from boto.exception import JSONResponseError
|
||||||
from moto import mock_dynamodb2
|
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
|
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():
|
def create_table():
|
||||||
table = Table.create('messages', schema=[
|
table = Table.create('messages', schema=[
|
||||||
HashKey('forum_name')
|
HashKey('forum_name')
|
||||||
|
Loading…
Reference in New Issue
Block a user