diff --git a/.travis.yml b/.travis.yml index dade7ce..6adedbb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,6 +33,7 @@ addons: python: - 3.6 - 3.7 + - 3.8 env: - PG=9.6 DJANGO=2.1 @@ -41,6 +42,9 @@ env: - PG=9.6 DJANGO=2.2 - PG=10 DJANGO=2.2 - PG=11 DJANGO=2.2 + - PG=9.6 DJANGO=3.0 + - PG=10 DJANGO=3.0 + - PG=11 DJANGO=3.0 before_install: # Use default PostgreSQL 11 port @@ -60,9 +64,8 @@ install: - sudo apt-get install clickhouse-client clickhouse-server clickhouse-common-static - sudo service clickhouse-server restart - - pip install -r requirements.txt + - pip install -r requirements-test.txt - pip install -q Django==$DJANGO.* - - pip install redis - python setup.py -q install before_script: diff --git a/requirements-test.txt b/requirements-test.txt new file mode 100644 index 0000000..e4635ac --- /dev/null +++ b/requirements-test.txt @@ -0,0 +1,11 @@ +Django (>=1.7) +pytz +six +typing +psycopg2 +infi.clickhouse-orm +celery +statsd +django-pg-returning +django-pg-bulk-update +redis \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 1283c62..208c860 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,5 +5,4 @@ typing psycopg2 infi.clickhouse-orm celery -statsd -django-pg-returning \ No newline at end of file +statsd \ No newline at end of file diff --git a/src/django_clickhouse/models.py b/src/django_clickhouse/models.py index 18b2947..9d38206 100644 --- a/src/django_clickhouse/models.py +++ b/src/django_clickhouse/models.py @@ -74,7 +74,7 @@ class ClickHouseSyncBulkUpdateQuerySetMixin(ClickHouseSyncRegisterMixin, BulkUpd def _decorate_method(self, name: str, operation: str, args, kwargs): if not hasattr(super(), name): - raise AttributeError(name) + raise AttributeError("QuerySet has no attribute %s. Is django-pg-bulk-update library installed?" % name) func = getattr(super(), name) original_returning = kwargs.pop('returning', None) diff --git a/tests/test_models.py b/tests/test_models.py index 97276ce..c9b39be 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -1,5 +1,7 @@ import datetime +from unittest import skipIf +import django from django.test import TransactionTestCase from django.utils.timezone import now @@ -61,6 +63,7 @@ class TestOperations(TransactionTestCase): self.assertSetEqual({('insert', "%s.%d" % (self.db_alias, instance.pk)) for instance in items}, set(self.storage.get_operations(self.clickhouse_model.get_import_key(), 10))) + @skipIf(django.VERSION < (2, 2), "bulk_update method has been introduced in django 2.2") def test_native_bulk_update(self): items = list(self.django_model.objects.filter(pk__in={1, 2})) for instance in items: