Skip to content

Commit

Permalink
Merge 6c3ed99 into 84ac2bf
Browse files Browse the repository at this point in the history
  • Loading branch information
lundberg committed Oct 24, 2019
2 parents 84ac2bf + 6c3ed99 commit 8d0711c
Show file tree
Hide file tree
Showing 12 changed files with 121 additions and 36 deletions.
50 changes: 40 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,53 @@ env:
- TOXENV=py35-django111
- TOXENV=py35-django20
- TOXENV=py35-django21
- TOXENV=py35-django22
- TOXENV=py36-django111
- TOXENV=py36-django20
- TOXENV=py36-django21
- TOXENV=py36-django22
- TOXENV=py36-django30
- TOXENV=py37-django111
- TOXENV=py37-django20
- TOXENV=py37-django21
- TOXENV=py37-django22
- TOXENV=py37-django30
- TOXENV=lint
- TOXENV=coverage

matrix:
include:
# NOTES:
#
# Django 2.2 requires SQLite 3.8.3+ which is not available on Ubuntu Trusty
# which is the default Ubuntu version on Travis CI. Run all Django 2.2+
# tests on Ubuntu Xenial instead.
#
# Python 3.7 on Travis CI is only available on Ubuntu Xenial.

- python: 3.5
env: TOXENV=py35-django111
- python: 3.5
env: TOXENV=py35-django20
- python: 3.5
env: TOXENV=py35-django21
- python: 3.5
env: TOXENV=py35-django22
dist: xenial

- python: 3.6
env: TOXENV=py36-django111
- python: 3.6
env: TOXENV=py36-django20
- python: 3.6
env: TOXENV=py36-django21
- python: 3.6
env: TOXENV=py36-django22
dist: xenial

# Python 3.7 on Travis CI is only available on Ubuntu Xenial.
- python: 3.7
env: TOXENV=py37-django22
- python: 3.6
env: TOXENV=py36-django30
dist: xenial

- python: 3.7
env: TOXENV=py37-django111
dist: xenial
Expand All @@ -37,13 +67,13 @@ matrix:
- python: 3.7
env: TOXENV=py37-django21
dist: xenial
- python: 3.7
env: TOXENV=py37-django22
dist: xenial
- python: 3.7
env: TOXENV=py37-django30
dist: xenial

- python: 3.6
env: TOXENV=py36-django111
- python: 3.6
env: TOXENV=py36-django20
- python: 3.6
env: TOXENV=py36-django21
- python: 3.5
env: TOXENV=lint
- python: 3.5
Expand Down
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ ARG PYTHON=3
FROM python:${PYTHON}

# Install system dependencies
ARG REQUIREMENTS="requirements.txt"
ARG DJANGO=">=2.0.9,<2.3"
RUN apt-get update && apt-get install -y \
gettext && \
pip install --pre "Django${DJANGO}"

# Install requirements
COPY example/requirements.txt /tmp/
RUN pip install --pre -r /tmp/requirements.txt
COPY example/requirements* /tmp/
RUN pip install --pre -r /tmp/${REQUIREMENTS}

# Install bananas source
WORKDIR /usr/src
Expand Down
5 changes: 2 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@ django-bananas is on PyPI, so just run:

Currently tested only for

- Django 1.8-2.0 under Python 3.4
- Django 1.8-2.2 under Python 3.5
- Django 1.11-2.2 under Python 3.6-3.7
- Django 1.11-2.2 under Python 3.5-3.7
- Django 3.0 under Python 3.6-3.7

pull requests welcome!

Expand Down
3 changes: 2 additions & 1 deletion bananas/admin/api/schemas/yasg.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
from rest_framework import permissions, viewsets
from rest_framework.authentication import SessionAuthentication
from rest_framework.routers import SimpleRouter
from rest_framework.schemas.generators import is_custom_action

from bananas.compat.drf import is_custom_action

from ..versioning import BananasVersioning
from .base import BananasBaseRouter
Expand Down
8 changes: 8 additions & 0 deletions bananas/compat/drf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from rest_framework import VERSION

version = tuple(map(int, VERSION.split(".")))

if version[:2] >= (3, 10):
from rest_framework.schemas.coreapi import is_custom_action # noqa
else:
from rest_framework.schemas.generators import is_custom_action # noqa
21 changes: 20 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,26 @@ services:
stdin_open: true
tty: true
ports:
- "8001:8000"
- "8002:8000"
volumes:
- .:/usr/src/django-bananas
- ./example:/app
environment:
PYTHONUNBUFFERED: "1"
PYTHONDONTWRITEBYTECODE: "True"
DJANGO_LANGUAGE_CODE: "sv-se"

django3:
build:
context: .
args:
DJANGO: "<3.1"
REQUIREMENTS: "requirements_django3.txt"
command: ["runserver", "0.0.0.0:8000"]
stdin_open: true
tty: true
ports:
- "8003:8000"
volumes:
- .:/usr/src/django-bananas
- ./example:/app
Expand Down
6 changes: 6 additions & 0 deletions example/example/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@
# Internationalization
# https://docs.djangoproject.com/en/1.11/topics/i18n/

LANGUAGES = [
(
env.get('DJANGO_LANGUAGE_CODE', 'en-us'),
env.get('DJANGO_LANGUAGE_CODE', 'en-us'),
),
]
LANGUAGE_CODE = env.get('DJANGO_LANGUAGE_CODE', 'en-us')

TIME_ZONE = 'UTC'
Expand Down
13 changes: 3 additions & 10 deletions example/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
# Django RestFramework
djangorestframework>=3.9.0,<3.10
coreapi>=2.3.3,<2.4
PyYAML>=4.2b1
-r requirements_base.txt

django-cors-headers>=2.4.0,<3
djangorestframework>=3.9.0,<3.10
drf-yasg>=1.15.0,<1.16

# Utils
coverage>=4.4.0,<4.6
flake8>=3,<4
black>=18,<19
git+https://github.com/timothycrosley/isort@fcd80d4#egg=isort
10 changes: 10 additions & 0 deletions example/requirements_base.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Django RestFramework
coreapi>=2.3.3,<2.4
PyYAML>=4.2b1

# Utils
six>=1.12,<1.13
coverage>=4.4.0,<4.6
flake8>=3,<4
black>=18,<19
git+https://github.com/timothycrosley/isort@fcd80d4#egg=isort
5 changes: 5 additions & 0 deletions example/requirements_django3.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
-r requirements_base.txt

django-cors-headers>=3.1.1,<3.2
djangorestframework==3.10.0
drf-yasg>=1.17,<1.18
6 changes: 3 additions & 3 deletions tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ def test_module(self):
environ.update({
'DJANGO_DEBUG': 'true',
'DJANGO_INTERNAL_IPS': '127.0.0.1, 10.0.0.1',
'DJANGO_FILE_UPLOAD_PERMISSIONS': '0o644',
'DJANGO_FILE_UPLOAD_DIRECTORY_PERMISSIONS': '0o644',
'DJANGO_SECRET_KEY': '123',
})

Expand All @@ -286,8 +286,8 @@ def test_module(self):
self.assertListEqual(settings.INTERNAL_IPS, ['127.0.0.1', '10.0.0.1'])
else:
self.assertTupleEqual(settings.INTERNAL_IPS, ('127.0.0.1', '10.0.0.1'))
self.assertIsNone(global_settings.FILE_UPLOAD_PERMISSIONS)
self.assertEqual(settings.FILE_UPLOAD_PERMISSIONS, 420)
self.assertIsNone(global_settings.FILE_UPLOAD_DIRECTORY_PERMISSIONS)
self.assertEqual(settings.FILE_UPLOAD_DIRECTORY_PERMISSIONS, 420)

def test_get_settings(self):
environ['DJANGO_ADMINS'] = 'foobar'
Expand Down
25 changes: 19 additions & 6 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

[tox]
envlist = py35-django{ 111, 20, 21, 22 },
py36-django{ 111, 20, 21, 22 },
py37-django{ 111, 20, 21, 22 }
py36-django{ 111, 20, 21, 22, 30 },
py37-django{ 111, 20, 21, 22, 30 }


[testenv]
Expand All @@ -23,11 +23,24 @@ deps = django111: Django>=1.11,<1.12
django20: Django>=2.0,<2.1
django21: Django>=2.1,<2.2
django22: Django>=2.2,<2.3
coverage
djangorestframework>=3.9.0,<3.10
django-cors-headers>=2.4.0,<3
drf-yasg>=1.15.0,<1.16
django30: Django<3.1
django111: djangorestframework>=3.9.0,<3.10
django20: djangorestframework>=3.9.0,<3.10
django21: djangorestframework>=3.9.0,<3.10
django22: djangorestframework>=3.9.0,<3.10
django30: djangorestframework>=3.10.0,<3.11
django111: drf-yasg>=1.15.0,<1.16
django20: drf-yasg>=1.15.0,<1.16
django21: drf-yasg>=1.15.0,<1.16
django22: drf-yasg>=1.15.0,<1.16
django30: drf-yasg>=1.17.0,<1.18
django111: django-cors-headers>=2.4.0,<3
django20: django-cors-headers>=2.4.0,<3
django21: django-cors-headers>=2.4.0,<3
django22: django-cors-headers>=2.4.0,<3
django30: django-cors-headers>=3.1.1,<3.2
pytz==2018.7
coverage


# Coverage report is sn separate env so that it's more
Expand Down

0 comments on commit 8d0711c

Please sign in to comment.