Add Django 4.2 compat' and update test dependencies.

This commit is contained in:
David Wobrock authored and David Wobrock committed 2023-07-02 20:36:03 +02:00
1 parent f511d51d9a
commit 366d16b01a
4 files changed
+35 -31

No files matched your search

+10 -10
View File
@@ -19,7 +19,7 @@ jobs:
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
mysql: mysql:
image: mysql:5.7 image: mysql:8.0
env: env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes MYSQL_ALLOW_EMPTY_PASSWORD: yes
ports: ports:
@@ -42,7 +42,7 @@ jobs:
with: with:
python-version: ${{ matrix.python-version }} python-version: ${{ matrix.python-version }}
- name: Install dependencies - name: Install dependencies
run: python -m pip install tox==3.28.0 tox-gh-actions run: python -m pip install tox==4.6.3 tox-gh-actions
- name: Test with tox ${{ matrix.python-version }} - name: Test with tox ${{ matrix.python-version }}
run: tox run: tox
@@ -52,12 +52,12 @@ jobs:
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Set up Python 3.10 - name: Set up Python 3.11
uses: actions/setup-python@v4 uses: actions/setup-python@v4
with: with:
python-version: '3.10' python-version: '3.11'
- name: Install dependencies - name: Install dependencies
run: python -m pip install tox==3.28.0 run: python -m pip install tox==4.6.3
- name: Lint with tox - name: Lint with tox
run: tox run: tox
env: env:
@@ -76,7 +76,7 @@ jobs:
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
mysql: mysql:
image: mysql:5.7 image: mysql:8.0
env: env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes MYSQL_ALLOW_EMPTY_PASSWORD: yes
ports: ports:
@@ -89,18 +89,18 @@ jobs:
# Fetch all tags and branches because tests rely on it # Fetch all tags and branches because tests rely on it
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Set up Python 3.10 - name: Set up Python 3.11
uses: actions/setup-python@v4 uses: actions/setup-python@v4
with: with:
python-version: '3.10' python-version: '3.11'
- name: Install dependencies and coverage - name: Install dependencies and coverage
run: python -m pip install tox==3.28.0 run: python -m pip install tox==4.6.3
- name: Test with tox with coverage - name: Test with tox with coverage
run: tox run: tox
env: env:
TOXENV: coverage TOXENV: coverage
- name: Upload coverage to Codecov - name: Upload coverage to Codecov
uses: codecov/codecov-action@v3.1.1 uses: codecov/codecov-action@v3.1.4
with: with:
token: ${{ secrets.CODECOV_TOKEN }} token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml file: ./coverage.xml
+5 -4
View File
@@ -40,11 +40,11 @@ setup(
], ],
extras_require={ extras_require={
"test": [ "test": [
"tox>=3.15.2", "tox>=4.6.3",
"mysqlclient>=1.4.6", "mysqlclient>=2.1.1",
"psycopg2>=2.8.5", "psycopg2>=2.9.6",
"django_add_default_value>=0.4.0", "django_add_default_value>=0.4.0",
"coverage>=5.5", "coverage>=7.2.7",
], ],
}, },
keywords="django migration lint linter database backward compatibility", keywords="django migration lint linter database backward compatibility",
@@ -56,6 +56,7 @@ setup(
"Framework :: Django :: 3.2", "Framework :: Django :: 3.2",
"Framework :: Django :: 4.0", "Framework :: Django :: 4.0",
"Framework :: Django :: 4.1", "Framework :: Django :: 4.1",
"Framework :: Django :: 4.2",
"Programming Language :: Python", "Programming Language :: Python",
"Programming Language :: Python :: 3", "Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.7",
+16 -16
View File
@@ -46,8 +46,8 @@ class CacheTestCase(unittest.TestCase):
cache = linter.new_cache cache = linter.new_cache
cache.load() cache.load()
self.assertEqual("OK", cache["ab2eef5ceb020d0e6eaa42dda2a754c5"]["result"]) self.assertEqual("OK", cache["eb6832d34f7ad40903a51a8b053ac13c"]["result"])
self.assertEqual("ERR", cache["52000d9d2c43dfda982945000dc6ba54"]["result"]) self.assertEqual("ERR", cache["31fa92230495861937bd6fd35b63c4e7"]["result"])
self.assertListEqual( self.assertListEqual(
[ [
Issue( Issue(
@@ -55,7 +55,7 @@ class CacheTestCase(unittest.TestCase):
message="NOT NULL constraint on columns", message="NOT NULL constraint on columns",
), ),
], ],
cache["52000d9d2c43dfda982945000dc6ba54"]["errors"], cache["31fa92230495861937bd6fd35b63c4e7"]["errors"],
) )
# Start the Linter again -> should use cache now. # Start the Linter again -> should use cache now.
@@ -96,8 +96,8 @@ class CacheTestCase(unittest.TestCase):
cache = linter.new_cache cache = linter.new_cache
cache.load() cache.load()
self.assertEqual("OK", cache["ab2eef5ceb020d0e6eaa42dda2a754c5"]["result"]) self.assertEqual("OK", cache["eb6832d34f7ad40903a51a8b053ac13c"]["result"])
self.assertEqual("ERR", cache["52000d9d2c43dfda982945000dc6ba54"]["result"]) self.assertEqual("ERR", cache["31fa92230495861937bd6fd35b63c4e7"]["result"])
self.assertListEqual( self.assertListEqual(
[ [
Issue( Issue(
@@ -105,7 +105,7 @@ class CacheTestCase(unittest.TestCase):
message="NOT NULL constraint on columns", message="NOT NULL constraint on columns",
), ),
], ],
cache["52000d9d2c43dfda982945000dc6ba54"]["errors"], cache["31fa92230495861937bd6fd35b63c4e7"]["errors"],
) )
# Start the Linter again but with different database, should not be the same cache # Start the Linter again but with different database, should not be the same cache
@@ -121,8 +121,8 @@ class CacheTestCase(unittest.TestCase):
cache = linter.new_cache cache = linter.new_cache
cache.load() cache.load()
self.assertEqual("OK", cache["ab2eef5ceb020d0e6eaa42dda2a754c5"]["result"]) self.assertEqual("OK", cache["eb6832d34f7ad40903a51a8b053ac13c"]["result"])
self.assertEqual("ERR", cache["52000d9d2c43dfda982945000dc6ba54"]["result"]) self.assertEqual("ERR", cache["31fa92230495861937bd6fd35b63c4e7"]["result"])
self.assertListEqual( self.assertListEqual(
[ [
Issue( Issue(
@@ -130,7 +130,7 @@ class CacheTestCase(unittest.TestCase):
message="NOT NULL constraint on columns", message="NOT NULL constraint on columns",
), ),
], ],
cache["52000d9d2c43dfda982945000dc6ba54"]["errors"], cache["31fa92230495861937bd6fd35b63c4e7"]["errors"],
) )
self.assertTrue(linter.has_errors) self.assertTrue(linter.has_errors)
@@ -180,7 +180,7 @@ class CacheTestCase(unittest.TestCase):
cache = linter.new_cache cache = linter.new_cache
cache.load() cache.load()
self.assertEqual("ERR", cache["52000d9d2c43dfda982945000dc6ba54"]["result"]) self.assertEqual("ERR", cache["31fa92230495861937bd6fd35b63c4e7"]["result"])
# Get the content of the migration file and mock the open call to append # Get the content of the migration file and mock the open call to append
# some content to change the hash # some content to change the hash
@@ -206,9 +206,9 @@ class CacheTestCase(unittest.TestCase):
cache = linter.new_cache cache = linter.new_cache
cache.load() cache.load()
self.assertNotIn("52000d9d2c43dfda982945000dc6ba54", cache) self.assertNotIn("31fa92230495861937bd6fd35b63c4e7", cache)
self.assertEqual(1, len(cache)) self.assertEqual(1, len(cache))
self.assertEqual("ERR", cache["edeb40ecc1f5550ebef876c8e8ca093d"]["result"]) self.assertEqual("ERR", cache["864f9dc59e9dccd57ef6fa45143f1ef0"]["result"])
@mock.patch( @mock.patch(
"django_migration_linter.MigrationLinter._gather_all_migrations", "django_migration_linter.MigrationLinter._gather_all_migrations",
@@ -232,8 +232,8 @@ class CacheTestCase(unittest.TestCase):
cache = linter.new_cache cache = linter.new_cache
cache.load() cache.load()
self.assertEqual("OK", cache["ab2eef5ceb020d0e6eaa42dda2a754c5"]["result"]) self.assertEqual("OK", cache["eb6832d34f7ad40903a51a8b053ac13c"]["result"])
self.assertEqual("ERR", cache["52000d9d2c43dfda982945000dc6ba54"]["result"]) self.assertEqual("ERR", cache["31fa92230495861937bd6fd35b63c4e7"]["result"])
self.assertListEqual( self.assertListEqual(
[ [
Issue( Issue(
@@ -241,7 +241,7 @@ class CacheTestCase(unittest.TestCase):
message="NOT NULL constraint on columns", message="NOT NULL constraint on columns",
), ),
], ],
cache["52000d9d2c43dfda982945000dc6ba54"]["errors"], cache["31fa92230495861937bd6fd35b63c4e7"]["errors"],
) )
# Start the Linter again -> should use cache now but ignore the erroneous # Start the Linter again -> should use cache now but ignore the erroneous
@@ -263,4 +263,4 @@ class CacheTestCase(unittest.TestCase):
cache = linter.new_cache cache = linter.new_cache
cache.load() cache.load()
self.assertEqual(1, len(cache)) self.assertEqual(1, len(cache))
self.assertEqual("OK", cache["ab2eef5ceb020d0e6eaa42dda2a754c5"]["result"]) self.assertEqual("OK", cache["eb6832d34f7ad40903a51a8b053ac13c"]["result"])
+4 -1
View File
@@ -3,6 +3,7 @@ envlist =
py{37,38,39,310}-django32 py{37,38,39,310}-django32
py{38,39,310}-django40 py{38,39,310}-django40
py{38,39,310,311}-django41 py{38,39,310,311}-django41
py{38,39,310,311}-django42
lint lint
coverage coverage
@@ -15,6 +16,7 @@ python =
3.11: py311 3.11: py311
[testenv] [testenv]
allowlist_externals = ./manage.py
commands = ./manage.py test --no-input {posargs} commands = ./manage.py test --no-input {posargs}
extras = test extras = test
pip_pre = true pip_pre = true
@@ -23,9 +25,10 @@ deps =
django32: django>=3.2,<3.3 django32: django>=3.2,<3.3
django40: django>=4.0,<4.1 django40: django>=4.0,<4.1
django41: django>=4.1,<4.2 django41: django>=4.1,<4.2
django42: django>=4.2,<4.3
[testenv:lint] [testenv:lint]
basepython = python3.10 basepython = python3.11
deps = pre-commit deps = pre-commit
commands = pre-commit run --all-files --show-diff-on-failure commands = pre-commit run --all-files --show-diff-on-failure