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

Django 1.11 and 2.0 support (drop django < 1.11) #72

Merged
merged 20 commits into from
Mar 15, 2018
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
27 changes: 16 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,25 @@ language: python

python:
- 3.5
- 2.7
- 3.6

env:
matrix:
- DJANGO=1.10 DATABASE_URL='sqlite://localhost/:memory:'
- DJANGO=1.10 DATABASE_URL='mysql://[email protected]/django_bulk_update_test'
- DJANGO=1.10 DATABASE_URL='postgres://[email protected]/django_bulk_update_test'
- DJANGO=1.9 DATABASE_URL='sqlite://localhost/:memory:'
- DJANGO=1.9 DATABASE_URL='mysql://[email protected]/django_bulk_update_test'
- DJANGO=1.9 DATABASE_URL='postgres://[email protected]/django_bulk_update_test'
- DJANGO=1.8 DATABASE_URL='sqlite://localhost/:memory:'
- DJANGO=1.8 DATABASE_URL='mysql://[email protected]/django_bulk_update_test'
- DJANGO=1.8 DATABASE_URL='postgres://[email protected]/django_bulk_update_test'
- DJANGO=1.11 DATABASE_URL='sqlite://localhost/:memory:'
- DJANGO=1.11 DATABASE_URL='mysql://[email protected]/django_bulk_update_test'
- DJANGO=1.11 DATABASE_URL='postgres://[email protected]/django_bulk_update_test'
- DJANGO=2.0 DATABASE_URL='sqlite://localhost/:memory:'
- DJANGO=2.0 DATABASE_URL='mysql://[email protected]/django_bulk_update_test'
- DJANGO=2.0 DATABASE_URL='postgres://[email protected]/django_bulk_update_test'

matrix:
include:
- python: 2.7
env: DJANGO=1.11 DATABASE_URL='sqlite://localhost/:memory:'
- python: 2.7
env: DJANGO=1.11 DATABASE_URL='mysql://[email protected]/django_bulk_update_test'
- python: 2.7
env: DJANGO=1.11 DATABASE_URL='postgres://[email protected]/django_bulk_update_test'

before_script:
- sh -c "if [ '$DATABASE_URL' = 'postgres://[email protected]/django_bulk_update_test' ];
then psql -c 'DROP DATABASE IF EXISTS django_bulk_update_test;' -U postgres; fi"
Expand Down
12 changes: 6 additions & 6 deletions tests/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def get_fixtures(n=None):
_time = time(13, 0)
fixtures = [
{
'big_age': 59999999999999999, 'comma_separated_age': '1,2,3',
'big_age': 59999999999999999,
'age': -99, 'positive_age': 9999, 'positive_small_age': 299,
'small_age': -299, 'certified': False, 'null_certified': None,
'name': 'Mike', 'email': '[email protected]',
Expand All @@ -30,7 +30,7 @@ def get_fixtures(n=None):
'image': 'kitten.jpg', 'data': {'name': 'Mike', 'age': -99},
},
{
'big_age': 245999992349999, 'comma_separated_age': '6,2,9',
'big_age': 245999992349999,
'age': 25, 'positive_age': 49999, 'positive_small_age': 315,
'small_age': 5409, 'certified': False, 'null_certified': True,
'name': 'Pete', 'email': '[email protected]',
Expand All @@ -42,7 +42,7 @@ def get_fixtures(n=None):
'data': [{'name': 'Pete'}, {'name': 'Mike'}],
},
{
'big_age': 9929992349999, 'comma_separated_age': '6,2,9,10,5',
'big_age': 9929992349999,
'age': 29, 'positive_age': 412399, 'positive_small_age': 23315,
'small_age': -5409, 'certified': False, 'null_certified': True,
'name': 'Ash', 'email': '[email protected]',
Expand All @@ -54,7 +54,7 @@ def get_fixtures(n=None):
'data': {'text': 'bla bla bla', 'names': ['Mike', 'Pete']},
},
{
'big_age': 9992349234, 'comma_separated_age': '12,29,10,5',
'big_age': 9992349234,
'age': -29, 'positive_age': 4199, 'positive_small_age': 115,
'small_age': 909, 'certified': True, 'null_certified': False,
'name': 'Mary', 'email': '[email protected]',
Expand All @@ -66,7 +66,7 @@ def get_fixtures(n=None):
'data': {'names': {'name': 'Mary'}},
},
{
'big_age': 999234, 'comma_separated_age': '12,1,30,50',
'big_age': 999234,
'age': 1, 'positive_age': 99199, 'positive_small_age': 5,
'small_age': -909, 'certified': False, 'null_certified': False,
'name': 'Sandra', 'email': '[email protected]',
Expand All @@ -77,7 +77,7 @@ def get_fixtures(n=None):
'image': 'dummy.jpeg', 'data': {},
},
{
'big_age': 9999999999, 'comma_separated_age': '1,100,3,5',
'big_age': 9999999999,
'age': 35, 'positive_age': 1111, 'positive_small_age': 500,
'small_age': 110, 'certified': True, 'null_certified': None,
'name': 'Crystal', 'email': '[email protected]',
Expand Down
10 changes: 5 additions & 5 deletions tests/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ class Person(models.Model):
"""
test model
"""
role = models.ForeignKey(Role, null=True)
role = models.ForeignKey(Role, null=True, on_delete=models.CASCADE)
big_age = models.BigIntegerField()
comma_separated_age = models.CommaSeparatedIntegerField(max_length=255)
#comma_separated_age = models.CommaSeparatedIntegerField(max_length=255)
age = models.IntegerField()
positive_age = models.PositiveIntegerField()
positive_small_age = models.PositiveSmallIntegerField()
Expand All @@ -40,8 +40,8 @@ class Person(models.Model):

remote_addr = models.GenericIPAddressField(null=True, blank=True)

my_file = models.FileField(upload_to='/some/path/', null=True, blank=True)
image = models.ImageField(upload_to='/some/path/', null=True, blank=True)
my_file = models.FileField(upload_to='some/path/', null=True, blank=True)
image = models.ImageField(upload_to='some/path/', null=True, blank=True)

data = JSONField(null=True, blank=True)

Expand All @@ -56,7 +56,7 @@ class Person(models.Model):

class Company(models.Model):
name = models.CharField(max_length=50)
president = models.ForeignKey(Person, related_name='companies')
president = models.ForeignKey(Person, related_name='companies', on_delete=models.CASCADE)


class PersonUUID(models.Model):
Expand Down
2 changes: 2 additions & 0 deletions tests/requirements/django-1.11.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-r requirements_base.txt
django>=1.11,<2
2 changes: 2 additions & 0 deletions tests/requirements/django-2.0.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-r requirements_base.txt
django>=2,<2.1
6 changes: 1 addition & 5 deletions tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@ def test_simple_fields(self):
'positive_small_age', 'small_age'):
self._test_field(field, fn)

def test_comma_separated_integer_field(self):
fn = lambda idx: str(idx) + ',27'
self._test_field('comma_separated_age', fn)

def test_boolean_field(self):
fn = lambda idx: [True, False][idx % 2]
self._test_field('certified', fn)
Expand Down Expand Up @@ -699,7 +695,7 @@ def test_batch_size(self):

class GetFieldsTests(TestCase):

total_fields = 25
total_fields = 24

def setUp(self):
create_fixtures()
Expand Down
8 changes: 4 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
[tox]
envlist =
py{27,35}-django{18,19,110}
py27-django111
py35-django{111,20}

[testenv]
setenv =
PYTHONDONTWRITEBYTECODE=1
install_command = pip install {opts} {packages}
deps =
django18: Django>=1.8,<1.9
django19: Django>=1.9,<1.10
django110: Django>=1.10,<1.11
django111: Django>=1.11,<2
django20: Django>=2,<2.1
-rrequirements-test.txt
commands = ./runtest.py {posargs}