Remove dynamodb Py3 boto restrictions since we only test newer boto now.

This commit is contained in:
Steve Pulec 2014-11-27 08:03:47 -05:00
parent edd13432d0
commit 06a635aeaa
5 changed files with 6 additions and 92 deletions

View File

@ -1,6 +1,5 @@
from __future__ import unicode_literals
import boto
import six
from nose.plugins.skip import SkipTest
@ -24,19 +23,3 @@ class requires_boto_gte(object):
if boto_version >= required:
return test
return skip_test
class py3_requires_boto_gte(object):
"""Decorator for requiring boto version greater than or equal to 'version'
when running on Python 3. (Not all of boto is Python 3 compatible.)"""
def __init__(self, version):
self.version = version
def __call__(self, test):
if not six.PY3:
return test
boto_version = version_tuple(boto.__version__)
required = version_tuple(self.version)
if boto_version >= required:
return test
return skip_test

View File

@ -1,11 +1,10 @@
from __future__ import unicode_literals
import six
import boto
import sure # noqa
from freezegun import freeze_time
from moto import mock_dynamodb
from tests.helpers import py3_requires_boto_gte
from boto.dynamodb import condition
from boto.dynamodb.exceptions import DynamoDBKeyNotFoundError, DynamoDBValidationError
@ -29,7 +28,6 @@ def create_table(conn):
return table
@py3_requires_boto_gte("2.33.0")
@freeze_time("2012-01-14")
@mock_dynamodb
def test_create_table():
@ -62,7 +60,6 @@ def test_create_table():
conn.describe_table('messages').should.equal(expected)
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb
def test_delete_table():
conn = boto.connect_dynamodb()
@ -75,7 +72,6 @@ def test_delete_table():
conn.layer1.delete_table.when.called_with('messages').should.throw(DynamoDBResponseError)
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb
def test_update_table_throughput():
conn = boto.connect_dynamodb()
@ -90,7 +86,6 @@ def test_update_table_throughput():
table.write_units.should.equal(6)
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb
def test_item_add_and_describe_and_update():
conn = boto.connect_dynamodb()
@ -138,7 +133,6 @@ def test_item_add_and_describe_and_update():
})
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb
def test_item_put_without_table():
conn = boto.connect_dynamodb()
@ -152,7 +146,6 @@ def test_item_put_without_table():
).should.throw(DynamoDBResponseError)
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb
def test_get_missing_item():
conn = boto.connect_dynamodb()
@ -165,7 +158,6 @@ def test_get_missing_item():
table.has_item("foobar", "more").should.equal(False)
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb
def test_get_item_with_undeclared_table():
conn = boto.connect_dynamodb()
@ -179,7 +171,6 @@ def test_get_item_with_undeclared_table():
).should.throw(DynamoDBKeyNotFoundError)
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb
def test_get_item_without_range_key():
conn = boto.connect_dynamodb()
@ -204,7 +195,6 @@ def test_get_item_without_range_key():
table.get_item.when.called_with(hash_key=hash_key).should.throw(DynamoDBValidationError)
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb
def test_delete_item():
conn = boto.connect_dynamodb()
@ -233,7 +223,6 @@ def test_delete_item():
item.delete.when.called_with().should.throw(DynamoDBResponseError)
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb
def test_delete_item_with_attribute_response():
conn = boto.connect_dynamodb()
@ -271,7 +260,6 @@ def test_delete_item_with_attribute_response():
item.delete.when.called_with().should.throw(DynamoDBResponseError)
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb
def test_delete_item_with_undeclared_table():
conn = boto.connect_dynamodb()
@ -285,7 +273,6 @@ def test_delete_item_with_undeclared_table():
).should.throw(DynamoDBResponseError)
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb
def test_query():
conn = boto.connect_dynamodb()
@ -336,7 +323,6 @@ def test_query():
results.response['Items'].should.have.length_of(1)
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb
def test_query_with_undeclared_table():
conn = boto.connect_dynamodb()
@ -353,7 +339,6 @@ def test_query_with_undeclared_table():
).should.throw(DynamoDBResponseError)
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb
def test_scan():
conn = boto.connect_dynamodb()
@ -417,7 +402,6 @@ def test_scan():
results.response['Items'].should.have.length_of(1)
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb
def test_scan_with_undeclared_table():
conn = boto.connect_dynamodb()
@ -435,7 +419,6 @@ def test_scan_with_undeclared_table():
).should.throw(DynamoDBResponseError)
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb
def test_write_batch():
conn = boto.connect_dynamodb()
@ -480,7 +463,6 @@ def test_write_batch():
table.item_count.should.equal(1)
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb
def test_batch_read():
conn = boto.connect_dynamodb()

View File

@ -1,11 +1,10 @@
from __future__ import unicode_literals
import six
import boto
import sure # noqa
from freezegun import freeze_time
from moto import mock_dynamodb
from tests.helpers import py3_requires_boto_gte
from boto.dynamodb import condition
from boto.dynamodb.exceptions import DynamoDBKeyNotFoundError
@ -27,7 +26,6 @@ def create_table(conn):
return table
@py3_requires_boto_gte("2.33.0")
@freeze_time("2012-01-14")
@mock_dynamodb
def test_create_table():
@ -56,7 +54,6 @@ def test_create_table():
conn.describe_table('messages').should.equal(expected)
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb
def test_delete_table():
conn = boto.connect_dynamodb()
@ -69,7 +66,6 @@ def test_delete_table():
conn.layer1.delete_table.when.called_with('messages').should.throw(DynamoDBResponseError)
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb
def test_update_table_throughput():
conn = boto.connect_dynamodb()
@ -84,7 +80,6 @@ def test_update_table_throughput():
table.write_units.should.equal(6)
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb
def test_item_add_and_describe_and_update():
conn = boto.connect_dynamodb()
@ -125,7 +120,6 @@ def test_item_add_and_describe_and_update():
})
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb
def test_item_put_without_table():
conn = boto.connect_dynamodb()
@ -138,7 +132,6 @@ def test_item_put_without_table():
).should.throw(DynamoDBResponseError)
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb
def test_get_missing_item():
conn = boto.connect_dynamodb()
@ -149,7 +142,6 @@ def test_get_missing_item():
).should.throw(DynamoDBKeyNotFoundError)
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb
def test_get_item_with_undeclared_table():
conn = boto.connect_dynamodb()
@ -162,7 +154,6 @@ def test_get_item_with_undeclared_table():
).should.throw(DynamoDBKeyNotFoundError)
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb
def test_delete_item():
conn = boto.connect_dynamodb()
@ -190,7 +181,6 @@ def test_delete_item():
item.delete.when.called_with().should.throw(DynamoDBResponseError)
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb
def test_delete_item_with_attribute_response():
conn = boto.connect_dynamodb()
@ -226,7 +216,6 @@ def test_delete_item_with_attribute_response():
item.delete.when.called_with().should.throw(DynamoDBResponseError)
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb
def test_delete_item_with_undeclared_table():
conn = boto.connect_dynamodb()
@ -239,7 +228,6 @@ def test_delete_item_with_undeclared_table():
).should.throw(DynamoDBResponseError)
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb
def test_query():
conn = boto.connect_dynamodb()
@ -260,7 +248,6 @@ def test_query():
results.response['Items'].should.have.length_of(1)
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb
def test_query_with_undeclared_table():
conn = boto.connect_dynamodb()
@ -271,7 +258,6 @@ def test_query_with_undeclared_table():
).should.throw(DynamoDBResponseError)
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb
def test_scan():
conn = boto.connect_dynamodb()
@ -332,7 +318,6 @@ def test_scan():
results.response['Items'].should.have.length_of(1)
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb
def test_scan_with_undeclared_table():
conn = boto.connect_dynamodb()
@ -350,7 +335,6 @@ def test_scan_with_undeclared_table():
).should.throw(DynamoDBResponseError)
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb
def test_write_batch():
conn = boto.connect_dynamodb()
@ -393,7 +377,6 @@ def test_write_batch():
table.item_count.should.equal(1)
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb
def test_batch_read():
conn = boto.connect_dynamodb()

View File

@ -1,11 +1,11 @@
from __future__ import unicode_literals
import six
import boto
import sure # noqa
from freezegun import freeze_time
from moto import mock_dynamodb2
from boto.exception import JSONResponseError
from tests.helpers import requires_boto_gte, py3_requires_boto_gte
from tests.helpers import requires_boto_gte
try:
from boto.dynamodb2.fields import HashKey
from boto.dynamodb2.fields import RangeKey
@ -33,7 +33,6 @@ def iterate_results(res):
@requires_boto_gte("2.9")
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb2
@freeze_time("2012-01-14")
def test_create_table():
@ -61,7 +60,6 @@ def test_create_table():
@requires_boto_gte("2.9")
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb2
def test_delete_table():
conn = boto.dynamodb2.layer1.DynamoDBConnection()
@ -74,7 +72,6 @@ def test_delete_table():
@requires_boto_gte("2.9")
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb2
def test_update_table_throughput():
table = create_table()
@ -100,7 +97,6 @@ def test_update_table_throughput():
@requires_boto_gte("2.9")
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb2
def test_item_add_and_describe_and_update():
table = create_table()
@ -144,7 +140,6 @@ def test_item_add_and_describe_and_update():
@requires_boto_gte("2.9")
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb2
def test_item_put_without_table():
table = Table('undeclared-table')
@ -159,7 +154,6 @@ def test_item_put_without_table():
@requires_boto_gte("2.9")
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb2
def test_get_missing_item():
table = create_table()
@ -171,7 +165,6 @@ def test_get_missing_item():
@requires_boto_gte("2.9")
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb2
def test_get_item_with_undeclared_table():
table = Table('undeclared-table')
@ -179,7 +172,6 @@ def test_get_item_with_undeclared_table():
@requires_boto_gte("2.9")
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb2
def test_get_item_without_range_key():
table = Table.create('messages', schema=[
@ -197,7 +189,6 @@ def test_get_item_without_range_key():
@requires_boto_gte("2.30.0")
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb2
def test_delete_item():
table = create_table()
@ -220,7 +211,6 @@ def test_delete_item():
@requires_boto_gte("2.9")
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb2
def test_delete_item_with_undeclared_table():
table = Table("undeclared-table")
@ -235,7 +225,6 @@ def test_delete_item_with_undeclared_table():
@requires_boto_gte("2.9")
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb2
def test_query():
table = create_table()
@ -293,7 +282,6 @@ def test_query():
@requires_boto_gte("2.9")
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb2
def test_query_with_undeclared_table():
table = Table('undeclared')
@ -306,7 +294,6 @@ def test_query_with_undeclared_table():
@requires_boto_gte("2.9")
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb2
def test_scan():
table = create_table()
@ -362,7 +349,6 @@ def test_scan():
@requires_boto_gte("2.9")
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb2
def test_scan_with_undeclared_table():
conn = boto.dynamodb2.layer1.DynamoDBConnection()
@ -380,7 +366,6 @@ def test_scan_with_undeclared_table():
@requires_boto_gte("2.9")
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb2
def test_write_batch():
table = create_table()
@ -411,7 +396,6 @@ def test_write_batch():
@requires_boto_gte("2.9")
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb2
def test_batch_read():
table = create_table()
@ -456,7 +440,6 @@ def test_batch_read():
@requires_boto_gte("2.9")
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb2
def test_get_key_fields():
table = create_table()

View File

@ -1,11 +1,11 @@
from __future__ import unicode_literals
import six
import boto
import sure # noqa
from freezegun import freeze_time
from boto.exception import JSONResponseError
from moto import mock_dynamodb2
from tests.helpers import requires_boto_gte, py3_requires_boto_gte
from tests.helpers import requires_boto_gte
try:
from boto.dynamodb2.fields import HashKey
from boto.dynamodb2.table import Table
@ -25,7 +25,6 @@ def create_table():
@requires_boto_gte("2.9")
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb2
@freeze_time("2012-01-14")
def test_create_table():
@ -57,7 +56,6 @@ def test_create_table():
@requires_boto_gte("2.9")
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb2
def test_delete_table():
create_table()
@ -71,7 +69,6 @@ def test_delete_table():
@requires_boto_gte("2.9")
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb2
def test_update_table_throughput():
table = create_table()
@ -88,7 +85,6 @@ def test_update_table_throughput():
@requires_boto_gte("2.9")
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb2
def test_item_add_and_describe_and_update():
table = create_table()
@ -123,7 +119,6 @@ def test_item_add_and_describe_and_update():
@requires_boto_gte("2.9")
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb2
def test_item_put_without_table():
conn = boto.dynamodb2.layer1.DynamoDBConnection()
@ -139,7 +134,6 @@ def test_item_put_without_table():
@requires_boto_gte("2.9")
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb2
def test_get_missing_item():
table = create_table()
@ -148,7 +142,6 @@ def test_get_missing_item():
@requires_boto_gte("2.9")
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb2
def test_get_item_with_undeclared_table():
conn = boto.dynamodb2.layer1.DynamoDBConnection()
@ -160,7 +153,6 @@ def test_get_item_with_undeclared_table():
@requires_boto_gte("2.30.0")
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb2
def test_delete_item():
table = create_table()
@ -185,7 +177,6 @@ def test_delete_item():
@requires_boto_gte("2.9")
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb2
def test_delete_item_with_undeclared_table():
conn = boto.dynamodb2.layer1.DynamoDBConnection()
@ -197,7 +188,6 @@ def test_delete_item_with_undeclared_table():
@requires_boto_gte("2.9")
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb2
def test_query():
table = create_table()
@ -218,7 +208,6 @@ def test_query():
@requires_boto_gte("2.9")
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb2
def test_query_with_undeclared_table():
conn = boto.dynamodb2.layer1.DynamoDBConnection()
@ -230,7 +219,6 @@ def test_query_with_undeclared_table():
@requires_boto_gte("2.9")
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb2
def test_scan():
table = create_table()
@ -282,7 +270,6 @@ def test_scan():
@requires_boto_gte("2.9")
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb2
def test_scan_with_undeclared_table():
conn = boto.dynamodb2.layer1.DynamoDBConnection()
@ -301,7 +288,6 @@ def test_scan_with_undeclared_table():
@requires_boto_gte("2.9")
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb2
def test_write_batch():
table = create_table()
@ -333,7 +319,6 @@ def test_write_batch():
@requires_boto_gte("2.9")
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb2
def test_batch_read():
table = create_table()
@ -375,7 +360,6 @@ def test_batch_read():
@requires_boto_gte("2.9")
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb2
def test_get_key_fields():
table = create_table()
@ -384,7 +368,6 @@ def test_get_key_fields():
@requires_boto_gte("2.9")
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb2
def test_get_special_item():
table = Table.create('messages', schema=[