1. Fixed bulk_update testing issue for django 2.1

2. Added python 3.8 and django 3.0 to travis testing
3. Split requirements.txt and requirements-test.txt
This commit is contained in:
M1ha 2020-02-07 11:14:39 +05:00
parent 54923e03bf
commit 210c36a127
5 changed files with 21 additions and 5 deletions

View File

@ -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:

11
requirements-test.txt Normal file
View File

@ -0,0 +1,11 @@
Django (>=1.7)
pytz
six
typing
psycopg2
infi.clickhouse-orm
celery
statsd
django-pg-returning
django-pg-bulk-update
redis

View File

@ -5,5 +5,4 @@ typing
psycopg2
infi.clickhouse-orm
celery
statsd
django-pg-returning
statsd

View File

@ -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)

View File

@ -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: