From f59f14980e23386623934eda05293e7d321591a8 Mon Sep 17 00:00:00 2001 From: Iacopo Spalletti Date: Tue, 12 Mar 2024 14:32:15 +0100 Subject: [PATCH] Update code --- .github/workflows/ci.yml | 3 ++- .pre-commit-config.yaml | 9 +++++++++ tests/models.py | 2 +- tests/test_documents.py | 2 +- tests/test_fields.py | 2 +- tox.ini | 6 +++--- 6 files changed, 17 insertions(+), 7 deletions(-) create mode 100644 .pre-commit-config.yaml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fada051..20fcbd8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,7 @@ jobs: matrix: python-version: ["3.9", "3.11"] django-version: ["3.2", "4.2"] - open-dsl-version: ["2.1", "2.4"] + open-dsl-version: ["2.2", "2.4"] exclude: - python-version: "3.11" @@ -53,6 +53,7 @@ jobs: - name: Run tests with Python ${{ matrix.python-version }} and Django ${{ matrix.django-version }} and opensearch-=py ${{ matrix.open-dsl-version }} run: | TOX_ENV=$(echo "py${{ matrix.python-version }}-django-${{ matrix.django-version }}-open${{ matrix.open-dsl-version }}" | tr -d .) + OPENSEARCH_URL=http://localhost:9200 python -m tox -e $TOX_ENV -- --elasticsearch python -m tox -e $TOX_ENV -- --elasticsearch --signal-processor celery diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..c8d8ba2 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,9 @@ +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +exclude: "(.idea|node_modules|.tox)" +repos: + - repo: https://github.com/adamchainz/django-upgrade + rev: "1.15.0" + hooks: + - id: django-upgrade + args: [--target-version, "3.2"] diff --git a/tests/models.py b/tests/models.py index d1bd4f1..8699b38 100644 --- a/tests/models.py +++ b/tests/models.py @@ -4,7 +4,7 @@ import django from django.db import models if django.VERSION < (4, 0): - from django.utils.translation import ugettext_lazy as _ + from django.utils.translation import gettext_lazy as _ else: from django.utils.translation import gettext_lazy as _ from six import python_2_unicode_compatible diff --git a/tests/test_documents.py b/tests/test_documents.py index c0a13c9..bca8178 100644 --- a/tests/test_documents.py +++ b/tests/test_documents.py @@ -7,7 +7,7 @@ from django.db import models if django.VERSION < (4, 0): - from django.utils.translation import ugettext_lazy as _ + from django.utils.translation import gettext_lazy as _ else: from django.utils.translation import gettext_lazy as _ from opensearchpy import GeoPoint, InnerDoc diff --git a/tests/test_fields.py b/tests/test_fields.py index d574cf0..fdf0416 100644 --- a/tests/test_fields.py +++ b/tests/test_fields.py @@ -3,7 +3,7 @@ import django from django.db.models.fields.files import FieldFile if django.VERSION < (4, 0): - from django.utils.translation import ugettext_lazy as _ + from django.utils.translation import gettext_lazy as _ else: from django.utils.translation import gettext_lazy as _ from mock import Mock, NonCallableMock diff --git a/tox.ini b/tox.ini index 5431c21..d819a78 100644 --- a/tox.ini +++ b/tox.ini @@ -1,7 +1,7 @@ [tox] envlist = - py{39}-django-{32,42}-{open21,open24} - py{311}-django-{41,42}-{open21,open24} + py{39}-django-{32,42}-{open22,open24} + py{311}-django-{41,42}-{open22,open24} [testenv] @@ -12,7 +12,7 @@ commands = coverage run --source django_elasticsearch_dsl runtests.py {posargs} deps = django-32: Django>=3.2,<3.3 django-42: Django>=4.2,<4.3 - open21: opensearch-py>=2.1.0,<2.2.0 + open22: opensearch-py>=2.2.0,<2.3.0 open24: opensearch-py>=2.4.0,<2.5.0 -r{toxinidir}/requirements_test.txt