support decimal fields (fix test)

This commit is contained in:
Itai Shirav 2018-10-14 12:26:45 +03:00
parent 4f4ce697e4
commit 475492a65f

View File

@ -3,7 +3,7 @@ from __future__ import unicode_literals
import unittest import unittest
from decimal import Decimal from decimal import Decimal
from infi.clickhouse_orm.database import Database from infi.clickhouse_orm.database import Database, ServerError
from infi.clickhouse_orm.models import Model from infi.clickhouse_orm.models import Model
from infi.clickhouse_orm.fields import * from infi.clickhouse_orm.fields import *
from infi.clickhouse_orm.engines import * from infi.clickhouse_orm.engines import *
@ -13,8 +13,15 @@ class DecimalFieldsTest(unittest.TestCase):
def setUp(self): def setUp(self):
self.database = Database('test-db') self.database = Database('test-db')
self.database.add_setting('allow_experimental_decimal_type', 1) self.database.add_setting('allow_experimental_decimal_typez', 1)
try:
self.database.create_table(DecimalModel) self.database.create_table(DecimalModel)
except ServerError as e:
if 'Unknown setting' in e.message:
# This ClickHouse version does not support decimals yet
raise unittest.SkipTest(e.message)
else:
raise
def tearDown(self): def tearDown(self):
self.database.drop_database() self.database.drop_database()