Ignore functions that don't exist in the used ClickHouse version

This commit is contained in:
Itai Shirav 2020-05-29 01:37:13 +03:00
parent bde5c75eba
commit efebfc67ed

View File

@ -30,11 +30,17 @@ class FuncsTestCase(TestCaseWithData):
def _test_func(self, func, expected_value=NO_VALUE): def _test_func(self, func, expected_value=NO_VALUE):
sql = 'SELECT %s AS value' % func.to_sql() sql = 'SELECT %s AS value' % func.to_sql()
logging.info(sql) logging.info(sql)
try:
result = list(self.database.select(sql)) result = list(self.database.select(sql))
logging.info('\t==> %s', result[0].value if result else '<empty>') logging.info('\t==> %s', result[0].value if result else '<empty>')
if expected_value != NO_VALUE: if expected_value != NO_VALUE:
self.assertEqual(result[0].value, expected_value) self.assertEqual(result[0].value, expected_value)
return result[0].value if result else None return result[0].value if result else None
except ServerError as e:
if 'Unknown function' in e.message:
logging.warning(e.message)
return # ignore functions that don't exist in the used ClickHouse version
raise
def _test_aggr(self, func, expected_value=NO_VALUE): def _test_aggr(self, func, expected_value=NO_VALUE):
qs = Person.objects_in(self.database).aggregate(value=func) qs = Person.objects_in(self.database).aggregate(value=func)