Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: CI

on:
push:
pull_request:
workflow_dispatch:

jobs:
test:
runs-on: ubuntu-latest

strategy:
fail-fast: false

matrix:
python-version: ["2.7", "3.6", "3.7", "3.8"]
django-version: ["1.11", "2.0", "2.2", "2.1", "3.0"]
es-dsl-version: ["6.4", "7.4"]
es-version: ["7.13.4"]

exclude:
- python-version: "2.7"
django-version: "2.0"
- python-version: "2.7"
django-version: "2.1"
- python-version: "2.7"
django-version: "2.2"
- python-version: "2.7"
django-version: "3.0"

- python-version: "3.8"
django-version: "1.11"
- python-version: "3.8"
django-version: "2.0"
- python-version: "3.8"
django-version: "2.1"

steps:
- name: Install and Run Elasticsearch
uses: elastic/elastic-github-actions/elasticsearch@master
with:
stack-version: ${{ matrix.es-version }}

- uses: actions/checkout@v2

- name: Install Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Cache Pip Dependencies
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements_test.txt') }}
restore-keys: |
${{ runner.os }}-pip-

- name: Install Dependencies
run: |
python -m pip install --upgrade pip
python -m pip install "Django==${{ matrix.django-version }}"
python -m pip install "elasticsearch-dsl==${{ matrix.es-dsl-version }}"
python -m pip install -r requirements_test.txt

- name: Run tests with Python ${{ matrix.python-version }} and Django ${{ matrix.django-version }} and elasticsearch-dsl-py ${{ matrix.es-dsl-version }}
run: |
TOX_ENV=$(echo "py${{ matrix.python-version }}-django-${{ matrix.django-version }}-es${{ matrix.es-dsl-version }}" | tr -d .)
python -m tox -e $TOX_ENV -- --elasticsearch

- name: Publish Coverage Report
uses: codecov/codecov-action@v1
62 changes: 0 additions & 62 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,6 @@ Before you submit a pull request, check that it meets these guidelines:
your new functionality into a function with a docstring, and add the
feature to the list in README.rst.
3. The pull request should work for Python 2.7, and 3.4, and for PyPy. Check
https://travis-ci.org/sabricot/django-elasticsearch-dsl/pull_requests
https://github.com/django-es/django-elasticsearch-dsl/actions
and make sure that the tests pass for all supported Python versions.

10 changes: 5 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
Django Elasticsearch DSL
========================

.. image:: https://travis-ci.org/sabricot/django-elasticsearch-dsl.png?branch=master
:target: https://travis-ci.org/sabricot/django-elasticsearch-dsl
.. image:: https://codecov.io/gh/sabricot/django-elasticsearch-dsl/coverage.svg?branch=master
:target: https://codecov.io/gh/sabricot/django-elasticsearch-dsl
.. image:: https://github.com/django-es/django-elasticsearch-dsl/actions/workflows/ci.yml/badge.svg
:target: https://github.com/django-es/django-elasticsearch-dsl/actions/workflows/ci.yml
.. image:: https://codecov.io/gh/django-es/django-elasticsearch-dsl/coverage.svg?branch=master
:target: https://codecov.io/gh/django-es/django-elasticsearch-dsl
.. image:: https://badge.fury.io/py/django-elasticsearch-dsl.svg
:target: https://pypi.python.org/pypi/django-elasticsearch-dsl
.. image:: https://readthedocs.org/projects/pip/badge/?version=latest&style=flat
.. image:: https://readthedocs.org/projects/django-elasticsearch-dsl/badge/?version=latest&style=flat
:target: https://django-elasticsearch-dsl.readthedocs.io/en/latest/

Django Elasticsearch DSL is a package that allows indexing of django models in elasticsearch.
Expand Down
2 changes: 1 addition & 1 deletion tests/test_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def test_get_value_from_instance_with_unknown_attr(self):
class Dummy:
attr1 = "foo"

field = DEDField(attr='attr2')
field = DEDField(attr='attr2', required=True)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any particular reason to add it to required ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test tries to assert VariableLookupError is raised. but VariableLookupError is not raised if required is not True.
This test also fails locally.

if self._required:
raise VariableLookupError(
"Failed lookup for key [{}] in "
"{!r}".format(attr, instance)
)

self.assertRaises(
VariableLookupError, field.get_value_from_instance, Dummy()
)
Expand Down
13 changes: 6 additions & 7 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
[tox]
envlist =
py27-django-111-es7
{py36,py37,py38}-django-{111,2,21,22,30}-{es7}
py27-django-111-es74
{py36,py37,py38}-django-{111,20,21,22,30}-{es64,es74}

[testenv]
setenv =
PYTHONPATH = {toxinidir}:{toxinidir}/django_elasticsearch_dsl
commands = python runtests.py {posargs}

commands = coverage run --source django_elasticsearch_dsl runtests.py {posargs}

deps =
django-111: Django>=1.11,<2.0
django-2: Django>=2.0,<2.1
django-20: Django>=2.0,<2.1
django-21: Django>=2.1,<2.2
django-22: Django>=2.2,<2.3
django-30: Django>=3.0,<3.1
es6: elasticsearch-dsl>=6.4.0,<7.0.0
es7: elasticsearch-dsl>=7,<8
es64: elasticsearch-dsl>=6.4.0,<7.0.0
es74: elasticsearch-dsl>=7.4.0,<8
-r{toxinidir}/requirements_test.txt

basepython =
Expand Down