diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fada051..f5299da 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,8 +53,8 @@ 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 .) - python -m tox -e $TOX_ENV -- --elasticsearch - python -m tox -e $TOX_ENV -- --elasticsearch --signal-processor celery + python -m tox -e $TOX_ENV -- --elasticsearch http://127.0.0.1:9200 + python -m tox -e $TOX_ENV -- --elasticsearch http://127.0.0.1:9200 --signal-processor celery - name: Publish Coverage Report uses: codecov/codecov-action@v3 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/runtests.py b/runtests.py index 52d4736..e97025c 100644 --- a/runtests.py +++ b/runtests.py @@ -120,7 +120,7 @@ def make_parser(): def run_tests(*test_args): args, test_args = make_parser().parse_known_args(test_args) if args.elasticsearch: - os.environ.setdefault('OPENSEARCH_URL', "https://127.0.0.1:9200") + os.environ.setdefault('OPENSEARCH_URL', args.elasticsearch) username = args.elasticsearch_username or "elastic" password = args.elasticsearch_password or "changeme" 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_commands.py b/tests/test_commands.py index 5266b17..a3f377e 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -1,3 +1,4 @@ +from django.conf import settings from mock import DEFAULT, Mock, patch from unittest import TestCase @@ -29,6 +30,7 @@ def _mock_setup(self): self.addCleanup(patch.stopall) def setUp(self): + print(settings.OPENSEARCH_DSL) self.out = StringIO() self.registry = DocumentRegistry() self.index_a = Index('foo') 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..5dabc72 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,10 +12,13 @@ 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 basepython = py39: python3.9 py311: python3.11 + +passenv = + OPENSEARCH*