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

Support Django version 2.2 and 3.0 #163

Merged
merged 3 commits into from
Jan 22, 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
14 changes: 11 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,29 @@
sudo: required
dist: trusty
dist: xenial
language: python
matrix:
include:
- python: 3.6
env: TOXENV=py36
env: TOXENV=py36-django22
- python: 3.6
env: TOXENV=py36-django30
- python: 3.6
env: TOXENV=flake8
- python: 3.6
env: TOXENV=pylint
- python: 3.6
env: TOXENV=black
services:
- postgresql
addons:
postgresql: "9.6"
apt:
packages:
- postgresql-9.6-postgis-2.3
- postgresql-9.6-postgis-2.4
- gdal-bin
- libgdal-dev
sources:
- sourceline: 'ppa:ubuntugis/ubuntugis-unstable'
before_script:
- psql -c 'CREATE DATABASE ona_tasking;' -U postgres
- psql -c 'CREATE EXTENSION postgis;' -U postgres -d ona_tasking
Expand Down
1 change: 1 addition & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ black = "==19.10b0"

[packages]
e1839a8 = {editable = true,path = "."}
ona-tasking = {editable = true,path = "."}
36 changes: 27 additions & 9 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
url="https://github.com/onaio/tasking",
packages=find_packages(exclude=["docs", "tests"]),
install_requires=[
"Django >= 1.11.19, < 2.1",
"Django >= 2.2",
"python-dateutil",
"markdown", # adds markdown support for browsable REST API
"django-filter", # for filtering in the API
Expand All @@ -25,6 +25,7 @@
"Programming Language :: Python",
"Programming Language :: Python :: 3.6",
"Framework :: Django",
"Framework :: Django :: 1.11",
"Framework :: Django :: 2.2",
"Framework :: Django :: 3.0",
],
)
3 changes: 2 additions & 1 deletion tests/serializers/test_segment_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ def test_validate_bad_data(self):
name="Rule Zero",
description="Some description",
target_content_type=self.task_type.id,
active=False,
target_field="invalid_field",
target_field_value=6,
target_app_label="tasking",
Expand All @@ -85,5 +86,5 @@ def test_validate_bad_data(self):
self.assertFalse(instance.is_valid())
self.assertEqual(
"Task has no field named 'invalid_field'",
str(instance.errors["target_field"][0]),
instance.errors["target_field"][0],
)
9 changes: 2 additions & 7 deletions tests/viewsets/test_locations.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import os

from django.test import override_settings
from django.utils import six

import pytz
from model_mommy import mommy
Expand Down Expand Up @@ -117,9 +116,7 @@ def test_create_location_with_shapefile_nested_multipolygons(self):
response = view(request=request)
self.assertEqual(response.status_code, 400)
self.assertIn("shapefile", response.data.keys())
self.assertEqual(
INVALID_SHAPEFILE, six.text_type(response.data["shapefile"][0])
)
self.assertEqual(INVALID_SHAPEFILE, response.data["shapefile"][0])

# should work
with self.settings(TASKING_SHAPEFILE_ALLOW_NESTED_MULTIPOLYGONS=True):
Expand Down Expand Up @@ -151,9 +148,7 @@ def test_create_location_with_shapefile_ignore_invalid(self):
response = view(request=request)
self.assertEqual(response.status_code, 400)
self.assertIn("shapefile", response.data.keys())
self.assertEqual(
INVALID_SHAPEFILE, six.text_type(response.data["shapefile"][0])
)
self.assertEqual(INVALID_SHAPEFILE, response.data["shapefile"][0])

# should work
with self.settings(TASKING_SHAPEFILE_IGNORE_INVALID_TYPES=True):
Expand Down
6 changes: 4 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tox]
envlist =
py36
py36-django{22,30}
flake8
pylint
black
Expand All @@ -22,7 +22,7 @@ commands =
pipenv sync --dev
pylint --rcfile={toxinidir}/.pylintrc {toxinidir}/tasking

[testenv: black]
[testenv:black]
deps =
black
pipenv
Expand All @@ -38,6 +38,8 @@ deps =
basepython = python3.6
commands =
pipenv sync --dev
django22: pip install Django>=2.2,<2.3
django30: pip install Django>=3.0,<3.1
coverage erase
coverage run --include="tasking/**.*" --omit="tests/**.*,tasking/migrations/**.*" manage.py test {toxinidir}/tests -v 2
coverage report