Skip to content

Commit

Permalink
Edit tests and setup for Django 3.2, Python 3.7 and above, Postgres 10
Browse files Browse the repository at this point in the history
  • Loading branch information
daliborpavlovic authored and jspetrak committed Apr 7, 2022
1 parent 6e2e461 commit 477ecbc
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 93 deletions.
51 changes: 8 additions & 43 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
language: python
dist: trusty
dist: bionic
sudo: false
addons:
postgresql: 9.5
postgresql: "10"
apt:
packages:
- postgresql-9.5-postgis-2.3
- postgresql-10-postgis-2.4
install: pip install tox coveralls
script: tox -e $TOX_ENV
after_success: coveralls
Expand All @@ -16,46 +16,11 @@ before_script:
- psql -U postgres -d multigtfs -c "CREATE EXTENSION IF NOT EXISTS postgis; CREATE EXTENSION IF NOT EXISTS postgis_topology;"
matrix:
include:
- env: TOX_ENV=py27-django18-postgis
python: "2.7"
- env: TOX_ENV=py34-django18-postgis
python: "3.4"
- env: TOX_ENV=py27-django19-postgis
python: "2.7"
- env: TOX_ENV=py35-django19-postgis
python: "3.5"
- env: TOX_ENV=py27-django110-postgis
python: "2.7"
- env: TOX_ENV=py35-django110-postgis
python: "3.5"
- env: TOX_ENV=py27-django111-postgis
python: "2.7"
- env: TOX_ENV=py36-django111-postgis
python: "3.6"
- env: TOX_ENV=py35-django20-postgis
python: "3.5"
- env: TOX_ENV=py36-django20-postgis
python: "3.6"
- env: TOX_ENV=py35-django21-postgis
python: "3.5"
- env: TOX_ENV=py36-django21-postgis
python: "3.6"
- env: TOX_ENV=py35-django22-postgis
python: "3.5"
- env: TOX_ENV=py37-django22-postgis
- env: TOX_ENV=py37-django-32-postgis
python: "3.7"
sudo: required
dist: xenial
- env: TOX_ENV=py35-django-master-postgis
python: "3.5"
- env: TOX_ENV=py36-django-master-postgis
python: "3.6"
- env: TOX_ENV=py37-django-master-postgis
python: "3.7"
sudo: required
dist: xenial
- env: TOX_ENV=py38-django-32-postgis
python: "3.8"
- env: TOX_ENV=py39-django-32-postgis
python: "3.9"
allow_failures:
# Django master is allowed to fail
- env: TOX_ENV=py35-django-master-postgis
- env: TOX_ENV=py36-django-master-postgis
- env: TOX_ENV=py37-django-master-postgis
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
FROM python:3.6
FROM python:3.7-buster
ENV PYTHONUNBUFFERED 1

RUN apt-get update
RUN apt-get install -y binutils libproj-dev gdal-bin postgresql-client
RUN pip install "django>=2.2" "psycopg2"
RUN pip install "django>=2.2,<4.0" "psycopg2"

RUN mkdir /code
RUN mkdir /feeds
Expand Down
14 changes: 2 additions & 12 deletions multigtfs/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"""
from codecs import BOM_UTF8
from distutils.version import LooseVersion
from io import TextIOWrapper
from zipfile import ZipFile, ZIP_DEFLATED

from django import get_version
Expand Down Expand Up @@ -75,7 +76,6 @@ def opener_from_zipfile(zipfile):

def opener(filename):
inner_file = zipfile.open(filename)
from io import TextIOWrapper
return TextIOWrapper(inner_file)

return opener
Expand All @@ -97,16 +97,6 @@ def write_text_rows(writer, rows):
writer.writerow(new_row)


# The GeoQuerySet is deprecated in Django 1.8
# https://docs.djangoproject.com/en/dev/releases/1.9/#django-contrib-gis
# The GeoManager is deprecated in Django 1.9
# https://docs.djangoproject.com/en/dev/releases/1.9/#geomanager-and-geoqueryset-custom-methods
# They are removed in Django 2.0
# https://docs.djangoproject.com/en/dev/releases/2.0/#features-removed-in-2-0
if DJ_VERSION >= LooseVersion('2.0'):
from django.db.models import Manager, QuerySet
else:
from django.contrib.gis.db.models import GeoManager as Manager
from django.contrib.gis.db.models.query import GeoQuerySet as QuerySet
from django.db.models import Manager, QuerySet
assert Manager
assert QuerySet
3 changes: 1 addition & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
Django>=2.2
jsonfield==3.1.0
Django>=3.2,<4.0
26 changes: 5 additions & 21 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,7 @@ def get_long_description():
return long_description


# Handle Py2/Py3 issue
if sys.version_info > (3, 0):
# In Py3, package data is dict w/ text key
package_data = {'multigtfs': ['tests/fixtures/*.zip']}
else:
# In Py2, package data is dict w/ binary string
package_data = {b'multigtfs': ['tests/fixtures/*.zip']}
package_data = {'multigtfs': ['tests/fixtures/*.zip']}


setup(
Expand All @@ -77,7 +71,7 @@ def get_long_description():
license='Apache License 2.0',
url='https://github.com/tulsawebdevs/django-multi-gtfs',
packages=find_packages(),
install_requires=['Django>=2.2', 'jsonfield>=0.9.20'],
install_requires=['Django>=3.2,<4.0'],
keywords=['django', 'gtfs'],
test_suite="run_tests", # Ignored, but makes pyroma happy
cmdclass={'test': my_test},
Expand All @@ -86,24 +80,14 @@ def get_long_description():
"Development Status :: 5 - Production/Stable",
"Environment :: Web Environment",
"Framework :: Django",
"Framework :: Django :: 1.8",
"Framework :: Django :: 1.9",
"Framework :: Django :: 1.10",
"Framework :: Django :: 1.11",
"Framework :: Django :: 2.0",
"Framework :: Django :: 2.1",
"Framework :: Django :: 2.2",
"Framework :: Django :: 3.2",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Topic :: Software Development :: Libraries :: Python Modules",
],
include_package_data=True,
Expand Down
15 changes: 2 additions & 13 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
[tox]
envlist =
py{27,34}-django18-{postgis,spatiallite}
py{27,34,35}-django{19,110}-{postgis,spatiallite}
py{27,34,35,36}-django111-{postgis,spatiallite}
py{35,36}-django20-{postgis,spatiallite}
py{35,36,37}-django{21,22,-master}-{postgis,spatiallite}
py{37,38,39}-django{32,-master}-{postgis,spatiallite}

[flake8]
exclude = .tox/*,.build/*,.dist/*,build/*
Expand All @@ -14,17 +10,10 @@ passenv = TRAVIS TRAVIS_JOB_ID TRAVIS_BRANCH
setenv =
postgis: MULTIGTFS_TEST_POSTGIS = 1
deps=
django18: Django>=1.8,<1.9
django19: Django>=1.9,<1.10
django110: Django>=1.10,<1.11
django111: Django>=1.11,<2.0
django20: Django>=2.0,<2.1
django21: Django>=2.1,<2.2
django22: Django>=2.2,<3.0
django32: Django>=3.2,<4.0
django-master: https://github.com/django/django/archive/master.tar.gz
postgis: psycopg2
nose
django-nose
jsonfield
coveralls
commands=coverage run --source multigtfs ./run_tests.py

0 comments on commit 477ecbc

Please sign in to comment.