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