Skip to content

Commit

Permalink
Test against current versions of django in CI
Browse files Browse the repository at this point in the history
 - Ignore .cache
 - Make test pass in django 1.9 by adding a bunch of app_labels
 - Remove requirements files, deps managed in tox.ini
  • Loading branch information
jieter committed Dec 17, 2015
1 parent 4cc22c9 commit ffd79ae
Show file tree
Hide file tree
Showing 18 changed files with 90 additions and 120 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -15,3 +15,4 @@
/example/database.sqlite
/example/.env
/report.pylint
.cache/
46 changes: 28 additions & 18 deletions .travis.yml
@@ -1,22 +1,32 @@
language: python
python:
- 2.7
env:
- TOX_ENV=py34-dj18
- TOX_ENV=py34-dj17
- TOX_ENV=py34-dj16
- TOX_ENV=py34-dj15
- TOX_ENV=py33-dj18
- TOX_ENV=py33-dj17
- TOX_ENV=py33-dj16
- TOX_ENV=py33-dj15
- TOX_ENV=py27-dj18
- TOX_ENV=py27-dj17
- TOX_ENV=py27-dj16
- TOX_ENV=py27-dj15
- TOX_ENV=py27-dj14
- TOX_ENV=py27-dj13

# django 1.9 is only supported on py27 and py35
# django 1.8 is the first realease supporting py35
matrix:
include:
- python: 2.7
env: TOXENV=py27-1.7
- python: 2.7
env: TOXENV=py27-1.8
- python: 3.2
env: TOXENV=py32-1.7
- python: 3.2
env: TOXENV=py32-1.8
- python: 3.3
env: TOXENV=py33-1.7
- python: 3.3
env: TOXENV=py33-1.8
- python: 3.4
env: TOXENV=py34-1.7
- python: 3.4
env: TOXENV=py34-1.8
- python: 3.4
env: TOXENV=py34-1.9
- python: 3.5
env: TOXENV=py35-1.8
- python: 3.5
env: TOXENV=py35-1.9
install:
- pip install tox
script:
- tox -e $TOX_ENV
- tox
2 changes: 1 addition & 1 deletion requirements/common.pip
@@ -1,4 +1,4 @@
django-haystack>=2.0.0,<2.1.0
django-haystack>=2.4.1,<2.5.0
fudge
lxml
pylint
Expand Down
2 changes: 0 additions & 2 deletions requirements/django-1.3.x.pip

This file was deleted.

2 changes: 0 additions & 2 deletions requirements/django-1.4.x.pip

This file was deleted.

2 changes: 0 additions & 2 deletions requirements/django-1.5.x.pip

This file was deleted.

2 changes: 0 additions & 2 deletions requirements/django-1.6.x.pip

This file was deleted.

2 changes: 0 additions & 2 deletions requirements/django-1.7.x.pip

This file was deleted.

2 changes: 0 additions & 2 deletions requirements/django-1.8.x.pip

This file was deleted.

9 changes: 6 additions & 3 deletions tests/app/settings.py
@@ -1,6 +1,7 @@
from django.conf import global_settings
import six
import os

import six
from django.conf import global_settings

DATABASES = {
'default': {
Expand All @@ -11,6 +12,8 @@

INSTALLED_APPS = [
'tests.app',
'django.contrib.contenttypes',
'django.contrib.auth',
'django_tables2',
]

Expand All @@ -34,4 +37,4 @@
'default': {
'ENGINE': 'haystack.backends.simple_backend.SimpleEngine',
}
}
}
9 changes: 8 additions & 1 deletion tests/columns/test_booleancolumn.py
@@ -1,14 +1,19 @@
# coding: utf-8
# pylint: disable=R0912,E0102
from __future__ import unicode_literals
import django_tables2 as tables

from django.db import models

import django_tables2 as tables

from ..utils import attrs


def test_should_be_used_for_booleanfield():
class BoolModel(models.Model):
field = models.BooleanField()
class Meta:
app_label = 'django_tables2_test'

class Table(tables.Table):
class Meta:
Expand All @@ -22,6 +27,8 @@ class Meta:
def test_should_be_used_for_nullbooleanfield():
class NullBoolModel(models.Model):
field = models.NullBooleanField()
class Meta:
app_label = 'django_tables2_test'

class Table(tables.Table):
class Meta:
Expand Down
5 changes: 4 additions & 1 deletion tests/columns/test_datecolumn.py
@@ -1,12 +1,14 @@
# coding: utf-8
# pylint: disable=R0912,E0102
from __future__ import unicode_literals

from datetime import date

from django.db import models

import django_tables2 as tables


# Format string: https://docs.djangoproject.com/en/1.4/ref/templates/builtins/#date
# D -- Day of the week, textual, 3 letters -- 'Fri'
# b -- Month, textual, 3 letters, lowercase -- 'jan'
Expand Down Expand Up @@ -58,7 +60,8 @@ class Meta:
def test_should_be_used_for_datefields():
class DateModel(models.Model):
field = models.DateField()

class Meta:
app_label = 'django_tables2_test'
class Table(tables.Table):
class Meta:
model = DateModel
Expand Down
7 changes: 5 additions & 2 deletions tests/columns/test_datetimecolumn.py
@@ -1,18 +1,19 @@
# coding: utf-8
# pylint: disable=R0912,E0102
from __future__ import unicode_literals

from datetime import datetime

import pytz
from django.db import models

import django_tables2 as tables
import pytest

try:
from django.utils import timezone
except ImportError:
timezone = None
import pytz
import pytest

# Format string: https://docs.djangoproject.com/en/1.4/ref/templates/builtins/#date
# D -- Day of the week, textual, 3 letters -- 'Fri'
Expand Down Expand Up @@ -73,6 +74,8 @@ class Meta:
def test_should_be_used_for_datetimefields():
class DateTimeModel(models.Model):
field = models.DateTimeField()
class Meta:
app_label = 'django_tables2_test'

class Table(tables.Table):
class Meta:
Expand Down
2 changes: 2 additions & 0 deletions tests/columns/test_emailcolumn.py
Expand Up @@ -31,6 +31,8 @@ class Table(tables.Table):
def test_should_be_used_for_datetimefields():
class EmailModel(models.Model):
field = models.EmailField()
class Meta:
app_label = 'django_tables2_test'

class Table(tables.Table):
class Meta:
Expand Down
9 changes: 6 additions & 3 deletions tests/columns/test_filecolumn.py
Expand Up @@ -4,13 +4,14 @@

from os.path import dirname, join

from django.db import models
from django.db.models.fields.files import FieldFile
from django.core.files.base import ContentFile
from django.core.files.storage import FileSystemStorage
import pytest
from django.db import models
from django.db.models.fields.files import FieldFile

import django_tables2 as tables
import pytest

from ..utils import parse


Expand All @@ -30,6 +31,8 @@ def column():
def test_should_be_used_for_filefields():
class FileModel(models.Model):
field = models.FileField()
class Meta:
app_label = 'django_tables2_test'

class Table(tables.Table):
class Meta:
Expand Down
2 changes: 2 additions & 0 deletions tests/columns/test_urlcolumn.py
Expand Up @@ -18,6 +18,8 @@ class TestTable(tables.Table):
def test_should_be_used_for_urlfields():
class URLModel(models.Model):
field = models.URLField()
class Meta:
app_label = 'django_tables2_test'

class Table(tables.Table):
class Meta:
Expand Down
9 changes: 7 additions & 2 deletions tests/test_models.py
@@ -1,10 +1,10 @@
# coding: utf-8
import six
import pytest

from .app.models import Person, Occupation
import django_tables2 as tables
import pytest

from .app.models import Occupation, Person

pytestmark = pytest.mark.django_db

Expand Down Expand Up @@ -52,6 +52,8 @@ class ComplexModel(models.Model):
char = models.CharField(max_length=200)
fk = models.ForeignKey("self")
m2m = models.ManyToManyField("self")
class Meta:
app_label = 'django_tables2_test'

class ComplexTable(tables.Table):
class Meta:
Expand Down Expand Up @@ -159,6 +161,9 @@ class Article(models.Model):
name = models.CharField(max_length=200)
language = models.CharField(max_length=200, choices=LANGUAGES)

class Meta:
app_label = 'django_tables2_test'

def __unicode__(self):
return self.name

Expand Down
97 changes: 20 additions & 77 deletions tox.ini
@@ -1,90 +1,33 @@
[pytest]
DJANGO_SETTINGS_MODULE=tests.app.settings

[tox]
args_are_paths = false
envlist =
{py27,py32,py33,py34}-{1.7,1.8},
{py27,py34,py35}-{1.9, master}

[testenv]
basepython =
py27: python2.7
py32: python3.2
py33: python3.3
py34: python3.4
py35: python3.5
usedevelop = true
pip_pre = true
setenv = PYTHONPATH={toxinidir}
commands = py.test
deps =
1.7: Django>=1.7,<1.8
1.8: Django>=1.8,<1.9
1.9: Django>=1.9,<1.10
master: https://github.com/django/django/archive/master.tar.gz
-r{toxinidir}/requirements/common.pip

[testenv:docs]
changedir = docs
commands = make html
deps =
-r{toxinidir}/requirements/django-dev.pip
Sphinx

; -- python 3.4 ---------------------------------------------------------------

[testenv:py34-dj]
basepython = python3.4
commands = python -W error {envbindir}/coverage run setup.py test []
deps = -r{toxinidir}/requirements/django-dev.pip

[testenv:py34-dj18]
basepython = python3.4
deps = -r{toxinidir}/requirements/django-1.8.x.pip

[testenv:py34-dj17]
basepython = python3.4
deps = -r{toxinidir}/requirements/django-1.7.x.pip

[testenv:py34-dj16]
basepython = python3.4
deps = -r{toxinidir}/requirements/django-1.6.x.pip

[testenv:py34-dj15]
basepython = python3.4
deps = -r{toxinidir}/requirements/django-1.5.x.pip

; -- python 3.3 ---------------------------------------------------------------

[testenv:py33-dj]
basepython = python3.3
commands = python -W error {envbindir}/coverage run setup.py test []
deps = -r{toxinidir}/requirements/django-dev.pip

[testenv:py33-dj18]
basepython = python3.3
deps = -r{toxinidir}/requirements/django-1.8.x.pip

[testenv:py33-dj17]
basepython = python3.3
deps = -r{toxinidir}/requirements/django-1.7.x.pip

[testenv:py33-dj16]
basepython = python3.3
deps = -r{toxinidir}/requirements/django-1.6.x.pip

[testenv:py33-dj15]
basepython = python3.3
deps = -r{toxinidir}/requirements/django-1.5.x.pip

; -- python 2.7 ---------------------------------------------------------------

[testenv:py27-dj]
basepython = python2.7
commands = python -W error {envbindir}/coverage run setup.py test []
deps = -r{toxinidir}/requirements/django-dev.pip

[testenv:py27-dj18]
basepython = python2.7
deps = -r{toxinidir}/requirements/django-1.8.x.pip

[testenv:py27-dj17]
basepython = python2.7
deps = -r{toxinidir}/requirements/django-1.7.x.pip

[testenv:py27-dj16]
basepython = python2.7
deps = -r{toxinidir}/requirements/django-1.6.x.pip

[testenv:py27-dj15]
basepython = python2.7
deps = -r{toxinidir}/requirements/django-1.5.x.pip

[testenv:py27-dj14]
basepython = python2.7
deps = -r{toxinidir}/requirements/django-1.4.x.pip

[testenv:py27-dj13]
basepython = python2.7
deps = -r{toxinidir}/requirements/django-1.3.x.pip

0 comments on commit ffd79ae

Please sign in to comment.