Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Dependencies and CI/CD Setup #109

Merged
merged 7 commits into from
Apr 26, 2020
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
69 changes: 16 additions & 53 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,63 +1,26 @@
language: python
sudo: false
language: python
cache: pip
python:
- "2.7"
- "3.3"
- "3.4"
- "3.5"
- "pypy"
matrix:
include:
- python: "3.6"
env: DJANGO="Django>=1.11,<1.12"
- python: "3.6"
env: DJANGO="Django>=2.0,<2.1"
- python: "3.6"
env: DJANGO="Django>=2.1,<2.2" PYTEST_DJANGO="pytest-django==3.4.2"
# - python: "3.7"
# env: DJANGO="Django>=2.0,<2.1"
# - python: "3.7"
# env: DJANGO="Django>=2.1,<2.2" PYTEST_DJANGO="pytest-django==3.4.2"
exclude:
- python: "2.7"
env: DJANGO="Django>=2.0,<2.1"
- python: "2.7"
env: DJANGO="Django>=2.1,<2.2" PYTEST_DJANGO="pytest-django==3.4.2"
- python: "3.5"
env: DJANGO="Django>=1.7,<1.8"
- python: "3.3"
env: DJANGO="Django>=1.9,<1.10"
- python: "3.3"
env: DJANGO="Django>=1.10,<1.11"
- python: "3.3"
env: DJANGO="Django>=1.11,<1.12"
- python: "3.3"
env: DJANGO="Django>=2.0,<2.1"
- python: "pypy"
env: DJANGO="Django>=2.0,<2.1"
- python: "3.3"
env: DJANGO="Django>=2.1,<2.2" PYTEST_DJANGO="pytest-django==3.4.2"
- python: "3.4"
env: DJANGO="Django>=2.1,<2.2" PYTEST_DJANGO="pytest-django==3.4.2"
- python: "pypy"
env: DJANGO="Django>=2.1,<2.2" PYTEST_DJANGO="pytest-django==3.4.2"
- "3.6"
- "3.7"
- "3.8"
- "pypy3"

env:
global:
- PYTEST_DJANGO=pytest-django==2.9.1
matrix:
- DJANGO="Django>=1.7,<1.8"
- DJANGO="Django>=1.8,<1.9"
- DJANGO="Django>=1.9,<1.10"
- DJANGO="Django>=1.10,<1.11"
- DJANGO="Django>=1.11,<1.12"
- DJANGO="Django>=2.0,<2.1"
- DJANGO="Django>=2.1,<2.2" PYTEST_DJANGO="pytest-django==3.4.2"
install:
- pip install $DJANGO
- pip install -e .[test] $PYTEST_DJANGO
script:
- coverage run -m py.test advanced_filters
- pep8 --exclude=*urls.py --exclude=*migrations advanced_filters -v
- DJANGO="1.9"
- DJANGO="1.10"
- DJANGO="1.11"
- DJANGO="2.0"
- DJANGO="2.1"
- DJANGO="2.2"
- DJANGO="3.0"

install: pip install tox-travis coveralls
script: tox
after_success:
coveralls
2 changes: 1 addition & 1 deletion advanced_filters/form_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from django import forms

from django.utils import six
import six

logger = logging.getLogger('advanced_filters.form_helpers')

Expand Down
2 changes: 1 addition & 1 deletion advanced_filters/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from django.forms.formsets import formset_factory, BaseFormSet
from django.utils.functional import cached_property
from django.utils.translation import ugettext_lazy as _
from django.utils.six.moves import range, reduce
from six.moves import range, reduce
from django.utils.text import capfirst

import django
Expand Down
2 changes: 1 addition & 1 deletion advanced_filters/q_serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import base64
import time

from django.utils import six
import six
from django.db.models import Q
from django.core.serializers.base import SerializationError

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% extends "admin/change_form.html" %}

{% load i18n admin_static admin_modify admin_urls %}
{% load i18n static admin_modify admin_urls %}

{% block extrastyle %}
{{ adminform.media.css }}
Expand Down
21 changes: 11 additions & 10 deletions advanced_filters/tests/test_get_field_choices_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import django
import pytest
from django.utils.encoding import force_text
from django.utils.encoding import force_str
from tests.factories import ClientFactory

try:
Expand All @@ -16,7 +16,7 @@


def assert_json(content, expect):
assert json.loads(force_text(content)) == expect
assert json.loads(force_str(content)) == expect


def assert_view_error(client, error, exception=None, **view_kwargs):
Expand All @@ -34,22 +34,23 @@ def assert_view_error(client, error, exception=None, **view_kwargs):
assert_json(response.content, dict(error=error))


if django.VERSION < (1, 7):
NO_APP_INSTALLED_ERROR = "No installed app/model: foo.test"
NO_MODEL_ERROR = "No installed app/model: reps.Foo"
NO_APP_INSTALLED_ERROR = "No installed app with label 'foo'."

if django.VERSION < (1, 11):
NO_MODEL_ERROR = "App 'reps' doesn't have a 'foo' model."
else:
NO_APP_INSTALLED_ERROR = "No installed app with label 'foo'."
NO_MODEL_ERROR = "App 'reps' doesn't have a 'Foo' model."


if "PyPy" in getattr(sys, "subversion", ()):
ARGUMENT_LENGTH_ERROR = "expected length 2, got 1"
elif sys.version_info >= (3, 5):
if sys.version_info >= (3, 5):
ARGUMENT_LENGTH_ERROR = "not enough values to unpack (expected 2, got 1)"
else:
ARGUMENT_LENGTH_ERROR = "need more than 1 value to unpack"

MISSING_FIELD_ERROR = "SalesRep has no field named 'baz'"
if sys.version_info < (3, ) and django.VERSION < (1, 11):
MISSING_FIELD_ERROR = "SalesRep has no field named u'baz'"
else:
MISSING_FIELD_ERROR = "SalesRep has no field named 'baz'"


def test_invalid_view_kwargs(client):
Expand Down
6 changes: 3 additions & 3 deletions advanced_filters/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from django.contrib.admin.utils import get_fields_from_path
from django.db import models
from django.db.models.fields import FieldDoesNotExist
from django.utils.encoding import force_text
from django.utils.encoding import force_str
from django.views.generic import View

from braces.views import (CsrfExemptMixin, StaffuserRequiredMixin,
Expand Down Expand Up @@ -44,7 +44,7 @@ def get(self, request, model=None, field_name=None):
except (LookupError, FieldDoesNotExist) as e:
logger.debug("Invalid kwargs passed to view: %s", e)
return self.render_json_response(
{'error': force_text(e)}, status=400)
{'error': force_str(e)}, status=400)

choices = field.choices
# if no choices, populate with distinct values from instances
Expand All @@ -71,7 +71,7 @@ def get(self, request, model=None, field_name=None):
else:
choices = []

results = [{'id': c[0], 'text': force_text(c[1])} for c in sorted(
results = [{'id': c[0], 'text': force_str(c[1])} for c in sorted(
choices, key=itemgetter(0))]

return self.render_json_response({'results': results})
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def get_full_description():
packages=find_packages(exclude=['tests*', 'tests.*', '*.tests']),
include_package_data=True,
install_requires=[
'django-braces>=1.4.0,<2',
'django-braces>=1.4.0,<1.14.0',
'simplejson>=3.6.5,<4',
],
extras_require=dict(test=TEST_REQS),
Expand Down
50 changes: 34 additions & 16 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,29 +1,47 @@
[tox]
envlist =
py27-d{17,18,19,110}
py34-d{17,18,19,110,111,20}
py35-d{18,19,110,111,20,21}
py36-d{111,20,21}
py37-d{20,21}
pypy-d{17,18,19,110,111}
py27-django{19,110,111}
py35-django{19,110,111,20,21,22}
py36-django{111,20,21,22,30}
py37-django{111,20,21,22,30}
py38-django{22,30}
pypy3-django{19,110,111,20,21,22,30}

[pycodestyle]
max-line-length = 120

[testenv]
passenv = TRAVIS TRAVIS_*
deps =
d17: Django>=1.7,<1.8
d18: Django>=1.8,<1.9
d19: Django>=1.9,<1.10
d110: Django>=1.10,<1.11
d111: Django>=1.11,<1.12
d20: Django>=2.0,<2.1
d21: Django>=2.1,<2.2
!d21: pytest-django==2.9.1
d21: pytest-django==3.4.2
-rtest-reqs.txt
django19: Django>=1.9,<1.10
django110: Django>=1.10,<1.11
django111: Django>=1.11,<1.12
django20: Django>=2.0,<2.1
django21: Django>=2.1,<2.2
django22: Django>=2.1,<2.2
django30: Django>=2.1,<2.2

commands =
pip install -e .
coverage run -m py.test advanced_filters
coverage run -m pytest advanced_filters
pycodestyle --exclude=urls.py,migrations,.ropeproject -v advanced_filters

[travis]
python =
2.7: py27
3.5: py35
3.6: py36
3.7: py37
3.8: py38
pypy3: pypy3

[travis:env]
DJANGO =
1.9: django19
1.10: django110
1.11: django111
2.0: django20
2.1: django21
2.2: django22
3.0: django30