Merge pull request #43 from SectorLabs/fix-test-on-django20

Fix test on django20
This commit is contained in:
Swen Kooij 2018-01-29 13:39:09 +02:00 committed by GitHub
commit b27f1535ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 19 additions and 4 deletions

3
.gitignore vendored
View File

@ -19,3 +19,6 @@ dist/
# Ignore PyCharm # Ignore PyCharm
.idea/ .idea/
# Ignore tox environments
.tox/

View File

@ -28,7 +28,7 @@ build:
- -
command: flake8 ./localized_fields/ command: flake8 ./localized_fields/
- -
command: coverage run manage.py test command: tox
coverage: coverage:
file: '.coverage' file: '.coverage'
format: 'py-cc' format: 'py-cc'

View File

@ -1,6 +1,5 @@
-r base.txt -r base.txt
Django==1.11.9
django-autoslug==1.9.3 django-autoslug==1.9.3
django-bleach==0.3.0 django-bleach==0.3.0
django-coverage-plugin==1.3.1 django-coverage-plugin==1.3.1
@ -14,3 +13,4 @@ django-coverage-plugin==1.3.1
flake8==3.5.0 flake8==3.5.0
pep8==1.7.1 pep8==1.7.1
dj-database-url==0.4.2 dj-database-url==0.4.2
tox==2.9.1

View File

@ -32,7 +32,7 @@ class LocalizedExpressionsTestCase(TestCase):
cls.TestModel2 = get_fake_model( cls.TestModel2 = get_fake_model(
{ {
'text': LocalizedField(), 'text': LocalizedField(),
'other': models.ForeignKey(cls.TestModel1, related_name='features') 'other': models.ForeignKey(cls.TestModel1, related_name='features', on_delete=models.CASCADE)
} }
) )

View File

@ -175,7 +175,7 @@ class LocalizedSlugFieldTestCase(TestCase):
model = get_fake_model( model = get_fake_model(
{ {
'title': LocalizedField(), 'title': LocalizedField(),
'other': models.ForeignKey(model_fk), 'other': models.ForeignKey(model_fk, on_delete=models.CASCADE),
'slug': LocalizedUniqueSlugField(populate_from=('title', 'other.name')) 'slug': LocalizedUniqueSlugField(populate_from=('title', 'other.name'))
} }
) )

12
tox.ini Normal file
View File

@ -0,0 +1,12 @@
[tox]
envlist = py35-dj{111,20}
[testenv]
deps =
dj111: Django>=1.11,<1.12
dj20: Django>=2.0,<2.1
-rrequirements/test.txt
setenv =
DJANGO_SETTINGS_MODULE=settings
passenv = DATABASE_URL
commands = coverage run manage.py test