Cqlengine fixes to skip tests properly

This commit is contained in:
Kishan Karunaratne
2015-06-12 17:24:55 -07:00
parent 0c23abd439
commit b4a13d4bf0
5 changed files with 53 additions and 38 deletions

View File

@@ -153,14 +153,19 @@ class TestDate(BaseCassEngTestCase):
@classmethod
def setUpClass(cls):
if PROTOCOL_VERSION < 4:
raise unittest.SkipTest("Protocol v4 datatypes require native protocol 4+, currently using: {0}".format(PROTOCOL_VERSION))
return
sync_table(cls.DateTest)
@classmethod
def tearDownClass(cls):
if PROTOCOL_VERSION < 4:
return
drop_table(cls.DateTest)
def setUp(self):
if PROTOCOL_VERSION < 4:
raise unittest.SkipTest("Protocol v4 datatypes require native protocol 4+, currently using: {0}".format(PROTOCOL_VERSION))
def test_date_io(self):
today = date.today()
self.DateTest.objects.create(test_id=0, created_at=today)

View File

@@ -311,9 +311,11 @@ class NonModelFailureTest(BaseCassEngTestCase):
with self.assertRaises(CQLEngineException):
sync_table(self.FakeModel)
class StaticColumnTests(BaseCassEngTestCase):
def test_static_columns(self):
if PROTOCOL_VERSION < 2:
raise unittest.SkipTest("Native protocol 2+ required, currently using: {0}".format(PROTOCOL_VERSION))
@unittest.skipUnless(PROTOCOL_VERSION >= 2, "only runs against the cql3 protocol v2.0")
def test_static_columns():
class StaticModel(Model):
id = columns.Integer(primary_key=True)
c = columns.Integer(primary_key=True)

View File

@@ -437,7 +437,7 @@ class TestQuerying(BaseCassEngTestCase):
@classmethod
def setUpClass(cls):
if PROTOCOL_VERSION < 4:
raise unittest.SkipTest("Date query tests require native protocol 4+, currently using: {0}".format(PROTOCOL_VERSION))
return
super(TestQuerying, cls).setUpClass()
drop_table(TestQueryModel)
@@ -445,9 +445,16 @@ class TestQuerying(BaseCassEngTestCase):
@classmethod
def tearDownClass(cls):
if PROTOCOL_VERSION < 4:
return
super(TestQuerying, cls).tearDownClass()
drop_table(TestQueryModel)
def setUp(self):
if PROTOCOL_VERSION < 4:
raise unittest.SkipTest("Date query tests require native protocol 4+, currently using: {0}".format(PROTOCOL_VERSION))
def test_query_with_date(self):
uid = uuid4()
day = date(2013, 11, 26)

View File

@@ -32,8 +32,7 @@ from tests.integration.cqlengine.base import BaseCassEngTestCase
class UserDefinedTypeTests(BaseCassEngTestCase):
@classmethod
def setUpClass(self):
def setUp(self):
if PROTOCOL_VERSION < 3:
raise unittest.SkipTest("UDTs require native protocol 3+, currently using: {0}".format(PROTOCOL_VERSION))

View File

@@ -689,9 +689,11 @@ class TestObjectsProperty(BaseQuerySetUsage):
len(TestModel.objects) # evaluate queryset
assert TestModel.objects._result_cache is None
class PageQueryTests(BaseCassEngTestCase):
def test_paged_result_handling(self):
if PROTOCOL_VERSION < 2:
raise unittest.SkipTest("Paging requires native protocol 2+, currently using: {0}".format(PROTOCOL_VERSION))
@unittest.skipUnless(PROTOCOL_VERSION >= 2, "only runs against the cql3 protocol v2.0")
def test_paged_result_handling():
# addresses #225
class PagingTest(Model):
id = columns.Integer(primary_key=True)