Add Django 1.8-1.10 to tox and travis configs
This commit is contained in:
parent
254325159d
commit
17ef02d42d
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -6,4 +6,5 @@ local_settings.py
|
||||||
.idea
|
.idea
|
||||||
build
|
build
|
||||||
dist
|
dist
|
||||||
*.egg-info
|
*.egg-info
|
||||||
|
.coverage*
|
54
.travis.yml
54
.travis.yml
|
@ -1,11 +1,60 @@
|
||||||
language: python
|
language: python
|
||||||
|
|
||||||
|
python:
|
||||||
|
- "2.6"
|
||||||
|
- "2.7"
|
||||||
|
- "3.3"
|
||||||
|
- "3.4"
|
||||||
|
- "3.5"
|
||||||
|
env:
|
||||||
|
- DJANGO=1.4
|
||||||
|
- DJANGO=1.5
|
||||||
|
- DJANGO=1.6
|
||||||
|
- DJANGO=1.7
|
||||||
|
- DJANGO=1.8
|
||||||
|
- DJANGO=1.9
|
||||||
|
- DJANGO=1.10
|
||||||
|
matrix:
|
||||||
|
exclude:
|
||||||
|
- python: "2.6"
|
||||||
|
env: DJANGO=1.7
|
||||||
|
- python: "2.6"
|
||||||
|
env: DJANGO=1.8
|
||||||
|
- python: "2.6"
|
||||||
|
env: DJANGO=1.9
|
||||||
|
- python: "2.6"
|
||||||
|
env: DJANGO=1.10
|
||||||
|
- python: "3.3"
|
||||||
|
env: DJANGO=1.4
|
||||||
|
- python: "3.4"
|
||||||
|
env: DJANGO=1.4
|
||||||
|
- python: "3.5"
|
||||||
|
env: DJANGO=1.4
|
||||||
|
- python: "3.3"
|
||||||
|
env: DJANGO=1.5
|
||||||
|
- python: "3.4"
|
||||||
|
env: DJANGO=1.5
|
||||||
|
- python: "3.5"
|
||||||
|
env: DJANGO=1.5
|
||||||
|
- python: "3.4"
|
||||||
|
env: DJANGO=1.6
|
||||||
|
- python: "3.5"
|
||||||
|
env: DJANGO=1.6
|
||||||
|
- python: "3.5"
|
||||||
|
env: DJANGO=1.7
|
||||||
|
- python: "3.3"
|
||||||
|
env: DJANGO=1.9
|
||||||
|
- python: "3.3"
|
||||||
|
env: DJANGO=1.10
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- pip install -q --use-mirrors tox==1.6.1 coveralls==0.3
|
- pip install -q Django==$DJANGO
|
||||||
|
- pip install tox coveralls
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- coverage erase
|
- coverage erase
|
||||||
- tox
|
- PYTHONPATH=. coverage run -p example/run_tests.py
|
||||||
|
- PYTHONPATH=. coverage run -p example/run_tests.py example.settings_no_debug
|
||||||
after_success:
|
after_success:
|
||||||
- coverage combine
|
- coverage combine
|
||||||
- coveralls
|
- coveralls
|
||||||
|
@ -13,3 +62,4 @@ after_success:
|
||||||
notifications:
|
notifications:
|
||||||
email:
|
email:
|
||||||
- goinnn@gmail.com
|
- goinnn@gmail.com
|
||||||
|
- blag@users.noreply.github.com
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
|
||||||
from example.app.models import Book
|
from .models import Book
|
||||||
|
|
||||||
|
|
||||||
class BookAdmin(admin.ModelAdmin):
|
class BookAdmin(admin.ModelAdmin):
|
|
@ -14,11 +14,20 @@
|
||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with this software. If not, see <http://www.gnu.org/licenses/>.
|
# along with this software. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
from django import VERSION
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from django.forms.models import modelform_factory
|
from django.forms.models import modelform_factory
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
|
|
||||||
from example.app.models import Book
|
from .models import Book
|
||||||
|
|
||||||
|
|
||||||
|
if VERSION < (1, 9):
|
||||||
|
def get_field(model, name):
|
||||||
|
return model._meta.get_field_by_name(name)[0]
|
||||||
|
else:
|
||||||
|
def get_field(model, name):
|
||||||
|
return model._meta.get_field(name)
|
||||||
|
|
||||||
|
|
||||||
class MultiSelectTestCase(TestCase):
|
class MultiSelectTestCase(TestCase):
|
||||||
|
@ -30,7 +39,7 @@ class MultiSelectTestCase(TestCase):
|
||||||
self.assertEqual(Book.objects.filter(tags__contains='boring').count(), 0)
|
self.assertEqual(Book.objects.filter(tags__contains='boring').count(), 0)
|
||||||
|
|
||||||
def test_form(self):
|
def test_form(self):
|
||||||
form_class = modelform_factory(Book)
|
form_class = modelform_factory(Book, fields='__all__')
|
||||||
self.assertEqual(len(form_class.base_fields), 3)
|
self.assertEqual(len(form_class.base_fields), 3)
|
||||||
form = form_class({'title': 'new book',
|
form = form_class({'title': 'new book',
|
||||||
'categories': '1,2'})
|
'categories': '1,2'})
|
||||||
|
@ -49,26 +58,26 @@ class MultiSelectTestCase(TestCase):
|
||||||
|
|
||||||
def test_validate(self):
|
def test_validate(self):
|
||||||
book = Book.objects.get(id=1)
|
book = Book.objects.get(id=1)
|
||||||
Book._meta.get_field_by_name('tags')[0].clean(['sex', 'work'], book)
|
get_field(Book, 'tags').clean(['sex', 'work'], book)
|
||||||
try:
|
try:
|
||||||
Book._meta.get_field_by_name('tags')[0].clean(['sex1', 'work'], book)
|
get_field(Book, 'tags').clean(['sex1', 'work'], book)
|
||||||
raise AssertionError()
|
raise AssertionError()
|
||||||
except ValidationError:
|
except ValidationError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
Book._meta.get_field_by_name('categories')[0].clean(['1', '2', '3'], book)
|
get_field(Book, 'categories').clean(['1', '2', '3'], book)
|
||||||
try:
|
try:
|
||||||
Book._meta.get_field_by_name('categories')[0].clean(['1', '2', '3', '4'], book)
|
get_field(Book, 'categories').clean(['1', '2', '3', '4'], book)
|
||||||
raise AssertionError()
|
raise AssertionError()
|
||||||
except ValidationError:
|
except ValidationError:
|
||||||
pass
|
pass
|
||||||
try:
|
try:
|
||||||
Book._meta.get_field_by_name('categories')[0].clean(['11', '12', '13'], book)
|
get_field(Book, 'categories').clean(['11', '12', '13'], book)
|
||||||
raise AssertionError()
|
raise AssertionError()
|
||||||
except ValidationError:
|
except ValidationError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def test_serializer(self):
|
def test_serializer(self):
|
||||||
book = Book.objects.get(id=1)
|
book = Book.objects.get(id=1)
|
||||||
self.assertEqual(Book._meta.get_field_by_name('tags')[0].value_to_string(book), 'sex,work,happy')
|
self.assertEqual(get_field(Book, 'tags').value_to_string(book), 'sex,work,happy')
|
||||||
self.assertEqual(Book._meta.get_field_by_name('categories')[0].value_to_string(book), '1,3,5')
|
self.assertEqual(get_field(Book, 'categories').value_to_string(book), '1,3,5')
|
|
@ -20,6 +20,6 @@ except ImportError: # Django < 1.4
|
||||||
from django.conf.urls.defaults import include, patterns, url
|
from django.conf.urls.defaults import include, patterns, url
|
||||||
|
|
||||||
|
|
||||||
urlpatterns = patterns('example.app.views',
|
urlpatterns = patterns('app.views',
|
||||||
url(r'^$', 'app_index', name='app_index'),
|
url(r'^$', 'app_index', name='app_index'),
|
||||||
)
|
)
|
|
@ -157,7 +157,7 @@ INSTALLED_APPS = (
|
||||||
# 'django.contrib.admindocs',
|
# 'django.contrib.admindocs',
|
||||||
|
|
||||||
'multiselectfield',
|
'multiselectfield',
|
||||||
'example.app'
|
'app'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -208,3 +208,6 @@ if django.VERSION[0] == 1 and django.VERSION[1] >= 4:
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
LOGGING['handlers']['mail_admins']['filters'] = ['require_debug_false']
|
LOGGING['handlers']['mail_admins']['filters'] = ['require_debug_false']
|
||||||
|
|
||||||
|
if django.VERSION >= (1, 6):
|
||||||
|
TEST_RUNNER = 'django.test.runner.DiscoverRunner'
|
||||||
|
|
|
@ -34,7 +34,4 @@ if django.VERSION[0] == 1 and django.VERSION[1] >= 7:
|
||||||
from django.core.wsgi import get_wsgi_application
|
from django.core.wsgi import get_wsgi_application
|
||||||
application = get_wsgi_application()
|
application = get_wsgi_application()
|
||||||
|
|
||||||
if django.VERSION[0] == 1 and django.VERSION[1] <= 5:
|
management.call_command('test', 'app')
|
||||||
management.call_command('test', 'app')
|
|
||||||
else:
|
|
||||||
management.call_command('test', 'example.app')
|
|
||||||
|
|
|
@ -109,6 +109,11 @@ class MultiSelectField(models.CharField):
|
||||||
return value if isinstance(value, list) else value.split(',')
|
return value if isinstance(value, list) else value.split(',')
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
def from_db_value(self, value, expression, connection, context):
|
||||||
|
if value is None:
|
||||||
|
return value
|
||||||
|
return self.to_python(value)
|
||||||
|
|
||||||
def contribute_to_class(self, cls, name):
|
def contribute_to_class(self, cls, name):
|
||||||
super(MultiSelectField, self).contribute_to_class(cls, name)
|
super(MultiSelectField, self).contribute_to_class(cls, name)
|
||||||
if self.choices:
|
if self.choices:
|
||||||
|
@ -133,7 +138,8 @@ class MultiSelectField(models.CharField):
|
||||||
setattr(cls, 'get_%s_list' % self.name, get_list)
|
setattr(cls, 'get_%s_list' % self.name, get_list)
|
||||||
setattr(cls, 'get_%s_display' % self.name, get_display)
|
setattr(cls, 'get_%s_display' % self.name, get_display)
|
||||||
|
|
||||||
MultiSelectField = add_metaclass(models.SubfieldBase)(MultiSelectField)
|
if django.VERSION < (1, 8):
|
||||||
|
MultiSelectField = add_metaclass(models.SubfieldBase)(MultiSelectField)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from south.modelsinspector import add_introspection_rules
|
from south.modelsinspector import add_introspection_rules
|
||||||
|
|
13
setup.py
13
setup.py
|
@ -35,12 +35,25 @@ setup(
|
||||||
'Framework :: Django',
|
'Framework :: Django',
|
||||||
'License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)',
|
'License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)',
|
||||||
'Programming Language :: Python :: 2',
|
'Programming Language :: Python :: 2',
|
||||||
|
'Programming Language :: Python :: 2.6',
|
||||||
|
'Programming Language :: Python :: 2.7',
|
||||||
'Programming Language :: Python :: 3',
|
'Programming Language :: Python :: 3',
|
||||||
|
'Programming Language :: Python :: 3.3',
|
||||||
|
'Programming Language :: Python :: 3.4',
|
||||||
|
'Programming Language :: Python :: 3.5',
|
||||||
],
|
],
|
||||||
license="LGPL 3",
|
license="LGPL 3",
|
||||||
keywords="django,multiple,select,field,choices",
|
keywords="django,multiple,select,field,choices",
|
||||||
url='https://github.com/goinnn/django-multiselectfield',
|
url='https://github.com/goinnn/django-multiselectfield',
|
||||||
packages=find_packages(),
|
packages=find_packages(),
|
||||||
include_package_data=True,
|
include_package_data=True,
|
||||||
|
tests_require=[
|
||||||
|
'django>=1.4',
|
||||||
|
'tox',
|
||||||
|
'coverage',
|
||||||
|
],
|
||||||
|
install_requires=[
|
||||||
|
'django>=1.4',
|
||||||
|
],
|
||||||
zip_safe=False,
|
zip_safe=False,
|
||||||
)
|
)
|
||||||
|
|
121
tox.ini
121
tox.ini
|
@ -1,18 +1,18 @@
|
||||||
[tox]
|
[tox]
|
||||||
envlist = py27-dj17,py27-dj16,py27-dj15,py27-dj14,py34-dj17,py33-dj17,py33-dj16,py33-dj15,py26-dj16,py26-dj15,py26-dj14
|
envlist = py26-dj14,py27-dj14,py26-dj15,py27-dj15,py26-dj16,py27-dj16,py33-dj16,py27-dj17,py33-dj17,py34-dj17,py27-dj18,py33-dj18,py34-dj18,py35-dj18,py27-dj19,py34-dj19,py35-dj19,py27-dj110,py34-dj110,py35-dj110
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
usedevelop = True
|
usedevelop = True
|
||||||
commands =
|
commands =
|
||||||
python {envbindir}/coverage run -p example/run_tests.py
|
PYTHONPATH=. python {envbindir}/coverage run -p example/run_tests.py
|
||||||
python {envbindir}/coverage run -p example/run_tests.py example.settings_no_debug
|
PYTHONPATH=. python {envbindir}/coverage run -p example/run_tests.py example.settings_no_debug
|
||||||
install_command =
|
install_command =
|
||||||
pip install {opts} {packages}
|
pip install {opts} {packages}
|
||||||
|
|
||||||
[testenv:py26-dj16]
|
[testenv:py26-dj14]
|
||||||
basepython = python2.6
|
basepython = python2.6
|
||||||
deps =
|
deps =
|
||||||
django==1.6
|
django==1.4.10
|
||||||
pillow==1.7.8
|
pillow==1.7.8
|
||||||
PyYAML==3.10
|
PyYAML==3.10
|
||||||
coveralls==0.3
|
coveralls==0.3
|
||||||
|
@ -25,18 +25,27 @@ deps =
|
||||||
PyYAML==3.10
|
PyYAML==3.10
|
||||||
coveralls==0.3
|
coveralls==0.3
|
||||||
|
|
||||||
[testenv:py26-dj14]
|
[testenv:py26-dj16]
|
||||||
basepython = python2.6
|
basepython = python2.6
|
||||||
|
deps =
|
||||||
|
django==1.6
|
||||||
|
pillow==1.7.8
|
||||||
|
PyYAML==3.10
|
||||||
|
coveralls==0.3
|
||||||
|
|
||||||
|
|
||||||
|
[testenv:py27-dj14]
|
||||||
|
basepython = python2.7
|
||||||
deps =
|
deps =
|
||||||
django==1.4.10
|
django==1.4.10
|
||||||
pillow==1.7.8
|
pillow==1.7.8
|
||||||
PyYAML==3.10
|
PyYAML==3.10
|
||||||
coveralls==0.3
|
coveralls==0.3
|
||||||
|
|
||||||
[testenv:py27-dj17]
|
[testenv:py27-dj15]
|
||||||
basepython = python2.7
|
basepython = python2.7
|
||||||
deps =
|
deps =
|
||||||
django==1.7
|
django==1.5.5
|
||||||
pillow==1.7.8
|
pillow==1.7.8
|
||||||
PyYAML==3.10
|
PyYAML==3.10
|
||||||
coveralls==0.3
|
coveralls==0.3
|
||||||
|
@ -49,36 +58,35 @@ deps =
|
||||||
PyYAML==3.10
|
PyYAML==3.10
|
||||||
coveralls==0.3
|
coveralls==0.3
|
||||||
|
|
||||||
|
[testenv:py27-dj17]
|
||||||
[testenv:py27-dj15]
|
|
||||||
basepython = python2.7
|
basepython = python2.7
|
||||||
deps =
|
deps =
|
||||||
django==1.5.5
|
django==1.7
|
||||||
pillow==1.7.8
|
pillow==1.7.8
|
||||||
PyYAML==3.10
|
PyYAML==3.10
|
||||||
coveralls==0.3
|
coveralls==0.3
|
||||||
|
|
||||||
[testenv:py27-dj14]
|
[testenv:py27-dj18]
|
||||||
basepython = python2.7
|
basepython = python2.7
|
||||||
deps =
|
deps =
|
||||||
django==1.4.10
|
django==1.8
|
||||||
pillow==1.7.8
|
pillow==1.7.8
|
||||||
PyYAML==3.10
|
PyYAML==3.10
|
||||||
coveralls==0.3
|
coveralls==0.3
|
||||||
|
|
||||||
[testenv:py34-dj17]
|
[testenv:py27-dj19]
|
||||||
basepython = python3.4
|
basepython = python2.7
|
||||||
deps =
|
deps =
|
||||||
django==1.7
|
django==1.9
|
||||||
pillow==2.1.0
|
pillow==1.7.8
|
||||||
PyYAML==3.10
|
PyYAML==3.10
|
||||||
coveralls==0.3
|
coveralls==0.3
|
||||||
|
|
||||||
[testenv:py33-dj17]
|
[testenv:py27-dj110]
|
||||||
basepython = python3.3
|
basepython = python2.7
|
||||||
deps =
|
deps =
|
||||||
django==1.7
|
django==1.10
|
||||||
pillow==2.1.0
|
pillow==1.7.8
|
||||||
PyYAML==3.10
|
PyYAML==3.10
|
||||||
coveralls==0.3
|
coveralls==0.3
|
||||||
|
|
||||||
|
@ -91,11 +99,76 @@ deps =
|
||||||
PyYAML==3.10
|
PyYAML==3.10
|
||||||
coveralls==0.3
|
coveralls==0.3
|
||||||
|
|
||||||
|
[testenv:py33-dj17]
|
||||||
[testenv:py33-dj15]
|
|
||||||
basepython = python3.3
|
basepython = python3.3
|
||||||
deps =
|
deps =
|
||||||
django==1.5.5
|
django==1.7
|
||||||
|
pillow==2.1.0
|
||||||
|
PyYAML==3.10
|
||||||
|
coveralls==0.3
|
||||||
|
|
||||||
|
[testenv:py33-dj18]
|
||||||
|
basepython = python3.3
|
||||||
|
deps =
|
||||||
|
django==1.8
|
||||||
|
pillow==2.1.0
|
||||||
|
PyYAML==3.10
|
||||||
|
coveralls==0.3
|
||||||
|
|
||||||
|
|
||||||
|
[testenv:py34-dj17]
|
||||||
|
basepython = python3.4
|
||||||
|
deps =
|
||||||
|
django==1.7
|
||||||
|
pillow==2.1.0
|
||||||
|
PyYAML==3.10
|
||||||
|
coveralls==0.3
|
||||||
|
|
||||||
|
[testenv:py34-dj18]
|
||||||
|
basepython = python3.4
|
||||||
|
deps =
|
||||||
|
django==1.8
|
||||||
|
pillow==2.1.0
|
||||||
|
PyYAML==3.10
|
||||||
|
coveralls==0.3
|
||||||
|
|
||||||
|
[testenv:py34-dj19]
|
||||||
|
basepython = python3.4
|
||||||
|
deps =
|
||||||
|
django==1.9
|
||||||
|
pillow==2.1.0
|
||||||
|
PyYAML==3.10
|
||||||
|
coveralls==0.3
|
||||||
|
|
||||||
|
[testenv:py34-dj110]
|
||||||
|
basepython = python3.4
|
||||||
|
deps =
|
||||||
|
django==1.10
|
||||||
|
pillow==2.1.0
|
||||||
|
PyYAML==3.10
|
||||||
|
coveralls==0.3
|
||||||
|
|
||||||
|
|
||||||
|
[testenv:py35-dj18]
|
||||||
|
basepython = python3.5
|
||||||
|
deps =
|
||||||
|
django==1.8
|
||||||
|
pillow==2.1.0
|
||||||
|
PyYAML==3.10
|
||||||
|
coveralls==0.3
|
||||||
|
|
||||||
|
[testenv:py35-dj19]
|
||||||
|
basepython = python3.5
|
||||||
|
deps =
|
||||||
|
django==1.9
|
||||||
|
pillow==2.1.0
|
||||||
|
PyYAML==3.10
|
||||||
|
coveralls==0.3
|
||||||
|
|
||||||
|
[testenv:py35-dj110]
|
||||||
|
basepython = python3.5
|
||||||
|
deps =
|
||||||
|
django==1.10
|
||||||
pillow==2.1.0
|
pillow==2.1.0
|
||||||
PyYAML==3.10
|
PyYAML==3.10
|
||||||
coveralls==0.3
|
coveralls==0.3
|
||||||
|
|
Loading…
Reference in a new issue