Skip to content

Commit 458180d

Browse files
author
Ross Mechanic
authored
Added Django 2.2 to testing matrix (#555)
* Added Django 2.2 to testing matrix * fixed deprecation warnings * Fixed the tests * Fixed formatting * Updated travis file to include correct sqlite version * See if all build will work with dist: xenial * Check sqllite version * another attempt * try try again * Try updating tests * Revert "Try updating tests" This reverts commit 6e065f3. * Remove print * Try disabling migrations
1 parent 5bd8687 commit 458180d

File tree

6 files changed

+35
-19
lines changed

6 files changed

+35
-19
lines changed

.travis.yml

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
language: python
2-
2+
dist: xenial
33
sudo: false
44

55
python:
66
- 2.7
77
- 3.4
88
- 3.5
99
- 3.6
10+
- 3.7
1011

1112
env:
1213
- DJANGO="Django>=1.11,<1.12"
1314
- DJANGO="Django>=2.0,<2.1"
1415
- DJANGO="Django>=2.1,<2.2"
16+
- DJANGO="Django>=2.2,<2.3"
1517

1618
install:
1719
- pip install -U coverage codecov
@@ -35,18 +37,9 @@ matrix:
3537
env: DJANGO="Django>=2.1,<2.2"
3638
- python: 3.4
3739
env: DJANGO="Django>=2.1,<2.2"
38-
include:
39-
- python: 3.7
40-
env: DJANGO="Django>=1.11,<1.12"
41-
dist: xenial
42-
sudo: true
43-
- python: 3.7
44-
env: DJANGO="Django>=2.0,<2.1"
45-
dist: xenial
46-
sudo: true
47-
- python: 3.7
48-
env: DJANGO="Django>=2.1,<2.2"
49-
dist: xenial
50-
sudo: true
40+
- python: 2.7
41+
env: DJANGO="Django>=2.2,<2.3"
42+
- python: 3.4
43+
env: DJANGO="Django>=2.2,<2.3"
5144

5245
after_success: codecov

CHANGES.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Unreleased
55
----------
66
- Fixed BigAutoField not mirrored as BigInt (gh-556)
77
- Fixed most_recent() bug with excluded_fields (gh-561)
8-
8+
- Added official Django 2.2 support (gh-555)
99

1010
2.7.2 (2019-04-17)
1111
------------------

runtests.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,15 @@
2828
'django.contrib.messages',
2929
]
3030

31+
32+
class DisableMigrations:
33+
def __contains__(self, item):
34+
return True
35+
36+
def __getitem__(self, item):
37+
return None
38+
39+
3140
DEFAULT_SETTINGS = dict(
3241
ALLOWED_HOSTS=['localhost'],
3342
AUTH_USER_MODEL='custom_user.CustomUser',
@@ -43,6 +52,7 @@
4352
'ENGINE': 'django.db.backends.sqlite3',
4453
}
4554
},
55+
MIGRATION_MODULES=DisableMigrations(),
4656
TEMPLATES=[{
4757
'BACKEND': 'django.template.backends.django.DjangoTemplates',
4858
'APP_DIRS': True,

simple_history/registry_tests/tests.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from django.apps import apps
88
from django.contrib.auth import get_user_model
99
from django.core import management
10-
from django.test import TestCase
10+
from django.test import TestCase, override_settings
1111
from six.moves import cStringIO as StringIO
1212

1313
from simple_history import exceptions, register
@@ -206,6 +206,7 @@ def test_custom_attr(self):
206206
self.assertEqual(field.attr_name, "custom_poll")
207207

208208

209+
@override_settings(MIGRATION_MODULES={})
209210
class TestMigrate(TestCase):
210211
def test_makemigration_command(self):
211212
management.call_command(

simple_history/tests/tests/test_models.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1251,7 +1251,7 @@ def test_extra_ip_address_field_populated_on_save(self):
12511251

12521252
poll_history = poll.history.first()
12531253

1254-
self.assertEquals("192.168.0.1", poll_history.ip_address)
1254+
self.assertEqual("192.168.0.1", poll_history.ip_address)
12551255

12561256
def test_extra_ip_address_field_not_present_on_poll(self):
12571257
poll = PollWithHistoricalIPAddress.objects.create(
@@ -1321,7 +1321,11 @@ class MultiDBWithUsingTest(TestCase):
13211321
keyword argument in `save()`.
13221322
"""
13231323

1324-
multi_db = True
1324+
if django.VERSION >= (2, 2, 0, "final"):
1325+
databases = {"default", "other"}
1326+
else:
1327+
multi_db = True
1328+
13251329
db_name = "other"
13261330

13271331
def test_multidb_with_using_not_on_default(self):
@@ -1441,6 +1445,9 @@ def test_foreign_key_to_self_using_self_str(self):
14411445

14421446
@override_settings(**database_router_override_settings)
14431447
class MultiDBExplicitHistoryUserIDTest(TestCase):
1448+
if django.VERSION >= (2, 2):
1449+
databases = {"default", "other"}
1450+
14441451
def setUp(self):
14451452
self.user = get_user_model().objects.create(
14461453
username="username", email="[email protected]", password="top_secret"
@@ -1570,7 +1577,10 @@ def test_revert(self):
15701577

15711578
@override_settings(**database_router_override_settings_history_in_diff_db)
15721579
class SaveHistoryInSeparateDatabaseTestCase(TestCase):
1573-
multi_db = True
1580+
if django.VERSION >= (2, 2, 0, "final"):
1581+
databases = {"default", "other"}
1582+
else:
1583+
multi_db = True
15741584

15751585
def setUp(self):
15761586
self.model = ModelWithHistoryInDifferentDb.objects.create(name="test")

tox.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ envlist =
33
py{27,34,35,36,37}-django111,
44
py{34,35,36,37}-django20,
55
py{35,36,37}-django21,
6+
py{35,36,37}-django22,
67
py{35,36,37}-djangotrunk,
78
docs, flake8
89

@@ -32,6 +33,7 @@ deps =
3233
django111: Django>=1.11,<1.12
3334
django20: Django>=2.0,<2.1
3435
django21: Django>=2.1,<2.2
36+
django22: Django>=2.2,<2.3
3537
djangotrunk: https://github.com/django/django/tarball/master
3638
commands =
3739
coverage run -a --branch setup.py test

0 commit comments

Comments
 (0)