Skip to content

Commit

Permalink
Update code
Browse files Browse the repository at this point in the history
  • Loading branch information
yakky committed Mar 12, 2024
1 parent 97c3675 commit ee3b41f
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 9 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
9 changes: 9 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -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"]
2 changes: 1 addition & 1 deletion tests/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions tests/test_commands.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from django.conf import settings
from mock import DEFAULT, Mock, patch
from unittest import TestCase

Expand Down Expand Up @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion tests/test_documents.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/test_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 6 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -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]
Expand All @@ -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*

0 comments on commit ee3b41f

Please sign in to comment.