Skip to content

Commit b331fbf

Browse files
pfouquejpic
authored andcommitted
Update support and fix python 3.12
1 parent e94b4e9 commit b331fbf

File tree

10 files changed

+125
-54
lines changed

10 files changed

+125
-54
lines changed

.gitignore

+32-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,35 @@
11
__pycache__
2-
*pyc
3-
*egg-info
4-
.tox
2+
.venv
3+
.Python
4+
*.pyc
5+
*.orig
6+
.cache/
7+
*,cover
58
.coverage
6-
.cache
9+
.tox/
10+
.idea/
11+
*.sqlite
12+
13+
*.egg-info
14+
build/
15+
dist/
16+
venv/
17+
*.egg/
18+
src/cities_light/version.py
19+
20+
# Ignore the downloaded data.
21+
src/cities_light/data/
22+
23+
# vscode & codespaces
24+
.vscode/*
25+
!.vscode/settings.json
26+
!.vscode/tasks.json
27+
!.vscode/launch.json
28+
!.vscode/extensions.json
29+
*.code-workspace
30+
pythonenv3.8/
31+
32+
# Local History for Visual Studio Code
33+
.history/
34+
735
dbdiff/tests/db.sqlite3

.travis.yml

+51-8
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,57 @@ python:
44
- '3.6'
55
env:
66
matrix:
7-
- TOXENV=py27-django111-sqlite
8-
- TOXENV=py27-django111-postgresql
9-
- TOXENV=py36-django111-sqlite
10-
- TOXENV=py36-django111-postgresql
11-
- TOXENV=py36-django20-sqlite
12-
- TOXENV=py36-django20-postgresql
13-
- TOXENV=py36-django21-sqlite
14-
- TOXENV=py36-django21-postgresql
7+
- TOXENV=py310-django50-sqlite
8+
- TOXENV=py310-django50-mysql
9+
- TOXENV=py310-django50-postgresql
10+
- TOXENV=py311-django50-sqlite
11+
- TOXENV=py311-django50-mysql
12+
- TOXENV=py311-django50-postgresql
13+
- TOXENV=py312-django50-sqlite
14+
- TOXENV=py312-django50-mysql
15+
- TOXENV=py312-django50-postgresql
16+
- TOXENV=py38-django42-sqlite
17+
- TOXENV=py38-django42-mysql
18+
- TOXENV=py38-django42-postgresql
19+
- TOXENV=py39-django42-sqlite
20+
- TOXENV=py39-django42-mysql
21+
- TOXENV=py39-django42-postgresql
22+
- TOXENV=py310-django42-sqlite
23+
- TOXENV=py310-django42-mysql
24+
- TOXENV=py310-django42-postgresql
25+
- TOXENV=py311-django42-sqlite
26+
- TOXENV=py311-django42-mysql
27+
- TOXENV=py311-django42-postgresql
28+
- TOXENV=py38-django41-sqlite
29+
- TOXENV=py38-django41-mysql
30+
- TOXENV=py38-django41-postgresql
31+
- TOXENV=py39-django41-sqlite
32+
- TOXENV=py39-django41-mysql
33+
- TOXENV=py39-django41-postgresql
34+
- TOXENV=py310-django41-sqlite
35+
- TOXENV=py310-django41-mysql
36+
- TOXENV=py310-django41-postgresql
37+
- TOXENV=py311-django41-sqlite
38+
- TOXENV=py311-django41-mysql
39+
- TOXENV=py311-django41-postgresql
40+
- TOXENV=py38-django40-sqlite
41+
- TOXENV=py38-django40-mysql
42+
- TOXENV=py38-django40-postgresql
43+
- TOXENV=py39-django40-sqlite
44+
- TOXENV=py39-django40-mysql
45+
- TOXENV=py39-django40-postgresql
46+
- TOXENV=py310-django40-sqlite
47+
- TOXENV=py310-django40-mysql
48+
- TOXENV=py310-django40-postgresql
49+
- TOXENV=py38-django32-sqlite
50+
- TOXENV=py38-django32-mysql
51+
- TOXENV=py38-django32-postgresql
52+
- TOXENV=py39-django32-sqlite
53+
- TOXENV=py39-django32-mysql
54+
- TOXENV=py39-django32-postgresql
55+
- TOXENV=py310-django32-sqlite
56+
- TOXENV=py310-django32-mysql
57+
- TOXENV=py310-django32-postgresql
1558
- TOXENV=qa
1659
install:
1760
- pip install -U pip

CHANGELOG

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
Unreleased Refresh supported dependencies and support
2+
13
0.9.5 Add Fixture.exclude global
24

35
0.9.4 Fixes missing upstream commits in 0.9.3

README.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ See tests and docstrings for crunchy details.
9393
Requirements
9494
============
9595

96-
MySQL, SQLite and PostgreSQL, Python 2.7 and 3.4 are supported along with
97-
Django 1.7 to 1.10 - it's always better to support django's master so that we
96+
MySQL, SQLite and PostgreSQL, Python 3.8 to 3.12 are supported along with
97+
Django 3.2 to 5.0 - it's always better to support django's master so that we
9898
can **upgrade easily when it is released**, which is one of the selling points
9999
for having 100% coverage.
100100

dbdiff/tests/decimal_test/migrations/0001_initial.py

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
from __future__ import unicode_literals
3-
41
from django.db import models, migrations
52

63

dbdiff/tests/decimal_test/migrations/0002_auto_20160102_0914.py

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
from __future__ import unicode_literals
3-
41
from django.db import models, migrations
52

63

dbdiff/tests/test_compare.py

+8-19
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
"""Public API tests."""
22

3-
from __future__ import unicode_literals
4-
53
import os
64
import tempfile
75

86
from django import test
97
from django.contrib.auth.models import Group
108

11-
import six
12-
139
from ..exceptions import DiffFound, FixtureCreated
1410
from ..fixture import Fixture
1511

@@ -57,8 +53,8 @@ def test_000_fixture_auto_create(self):
5753
1 instance(s) of auth.group have not expected fields
5854
#1:
5955
name:
60-
- u'testgroup'
61-
+ u'BOOM'
56+
- 'testgroup'
57+
+ 'BOOM'
6258
'''
6359

6460
with self.assertRaises(DiffFound) as result:
@@ -73,12 +69,12 @@ def test_000_fixture_auto_create(self):
7369
expected = '''
7470
1 unexpected instance(s) of auth.group found in the dump:
7571
#2:
76-
{u'name': u'unexpected', u'permissions': []}
72+
{'name': 'unexpected', 'permissions': []}
7773
1 instance(s) of auth.group have not expected fields
7874
#1:
7975
name:
80-
- u'testgroup'
81-
+ u'BOOM'
76+
- 'testgroup'
77+
+ 'BOOM'
8278
'''
8379

8480
with self.assertRaises(DiffFound) as result:
@@ -90,24 +86,17 @@ def test_000_fixture_auto_create(self):
9086
expected = '''
9187
1 unexpected instance(s) of auth.group found in the dump:
9288
#2:
93-
{u'name': u'unexpected', u'permissions': []}
89+
{'name': 'unexpected', 'permissions': []}
9490
1 expected instance(s) of auth.group missing from dump:
9591
#1:
96-
{u'name': u'testgroup', u'permissions': []}
92+
{'name': 'testgroup', 'permissions': []}
9793
'''
9894

9995
with self.assertRaises(DiffFound) as result:
10096
fixture.assertNoDiff()
10197
self.assert_message_is(expected, result)
10298

10399
def assert_message_is(self, expected, result):
104-
if six.PY3:
105-
expected = expected.replace("u'", "'")
106-
107-
msg = (
108-
result.exception.message
109-
if six.PY2 else result.exception.args[0]
110-
)
111-
100+
msg = result.exception.args[0]
112101
out = '\n'.join(msg.split('\n')[1:])
113102
assert out.strip() == expected.strip()

dbdiff/utils.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
"""Utils for dbdiff."""
22

3-
import imp
43
import os
54

65
from django.apps import apps
76
from django.db import connections
87

9-
import six
10-
8+
from importlib.util import find_spec
119

1210
def get_tree(dump, exclude=None):
1311
"""Return a tree of model -> pk -> fields."""
@@ -86,7 +84,8 @@ def get_absolute_path(path):
8684
if path.startswith('.'):
8785
module_path = '.'
8886
else:
89-
module_path = imp.find_module(path.split('/')[0])[1]
87+
module_path = find_spec(path.split('/')[0]).submodule_search_locations[0]
88+
9089
return os.path.abspath(os.path.join(
9190
module_path,
9291
*path.split('/')[1:]
@@ -96,7 +95,7 @@ def get_absolute_path(path):
9695
def get_model_names(model_classes):
9796
"""Return model names for model classes."""
9897
return [
99-
m if isinstance(m, six.string_types)
98+
m if isinstance(m, str)
10099
else '%s.%s' % (m._meta.app_label, m._meta.model_name)
101100
for m in model_classes
102101
]

setup.py

+12-3
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,27 @@ def read(fname):
2222
long_description=read('README.rst'),
2323
license='MIT',
2424
keywords='django test database fixture diff',
25-
install_requires=['ijson', 'json_delta', 'six'],
25+
install_requires=['ijson', 'json_delta'],
2626
entry_points={'pytest11': ['dbdiff = dbdiff.plugin']},
2727
classifiers=[
2828
'Development Status :: 4 - Beta',
2929
'Environment :: Web Environment',
30-
'Framework :: Django',
3130
'Intended Audience :: Developers',
3231
'License :: OSI Approved :: MIT License',
3332
'Operating System :: OS Independent',
33+
'Framework :: Django',
34+
'Framework :: Django :: 3.2',
35+
'Framework :: Django :: 4.0',
36+
'Framework :: Django :: 4.1',
37+
'Framework :: Django :: 4.2',
38+
'Framework :: Django :: 5.0',
3439
'Programming Language :: Python',
35-
'Programming Language :: Python :: 2',
3640
'Programming Language :: Python :: 3',
41+
'Programming Language :: Python :: 3.8',
42+
'Programming Language :: Python :: 3.9',
43+
'Programming Language :: Python :: 3.10',
44+
'Programming Language :: Python :: 3.11',
45+
'Programming Language :: Python :: 3.12',
3746
'Topic :: Internet :: WWW/HTTP',
3847
'Topic :: Software Development :: Libraries :: Python Modules',
3948
],

tox.ini

+14-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
[tox]
2-
envlist = py{27,36,37}-django{18,110,111,20,21}{-sqlite,-mysql,-postgresql}
2+
envlist =
3+
py{310,311,312}-django50-{sqlite,mysql,postgresql}
4+
py{38,39,310,311}-django42-{sqlite,mysql,postgresql}
5+
py{38,39,310,311}-django41-{sqlite,mysql,postgresql}
6+
py{38,39,310}-django40-{sqlite,mysql,postgresql}
7+
py{38,39,310}-django32-{sqlite,mysql,postgresql}
38

49
[testenv]
510
usedevelop = true
@@ -16,11 +21,11 @@ deps =
1621
pytest-cov
1722
mock
1823
coverage
19-
django18: Django>=1.8,<1.9
20-
django10: Django>=1.10,<1.11
21-
django111: Django>=1.11,<2.0
22-
django20: Django>=2.0,<2.1
23-
django21: Django>=2.1,<2.2
24+
django50: Django==5.0a1
25+
django42: Django>=4.2,<5.0
26+
django41: Django>=4.1,<4.2
27+
django40: Django>=4.0,<4.1
28+
django32: Django>=3.2,<4.0
2429
postgresql: psycopg2
2530
mysql: mysqlclient
2631
setenv =
@@ -29,7 +34,9 @@ setenv =
2934
sqlite: DJANGO_SETTINGS_MODULE=dbdiff.tests.project.settings_sqlite
3035
postgresql: DJANGO_SETTINGS_MODULE=dbdiff.tests.project.settings_postgresql
3136
mysql: DJANGO_SETTINGS_MODULE=dbdiff.tests.project.settings_mysql
32-
passenv = TEST_* DBDIFF_*
37+
passenv =
38+
TEST_*
39+
DBDIFF_*
3340

3441
[testenv:qa]
3542
basepython = python2.7

0 commit comments

Comments
 (0)