Skip to content

Commit

Permalink
Support Django 4.1, 4.2 and Python 3.11 (#485)
Browse files Browse the repository at this point in the history
* Support Django 4.1 and 4.2 and Python 3.11

* Upgrade to tox 4

* Update precommit isort

* Suppress linting on Python 3.7
  • Loading branch information
johnthagen authored Jan 13, 2024
1 parent 790ec8b commit 8f32a28
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 13 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10"]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -24,7 +24,10 @@ jobs:
python -m pip install --upgrade pip
python -m pip install -r requirements/tests.txt
python -m pip install -r requirements.txt
- name: Linting
# TODO: Remove this conditional when Python 3.7 is dropped and Flake8 executes on
# all Python versions in matrix.
- if: matrix.python-version == '3.8'
name: Linting
run: flake8
# Environments are selected using tox-gh-actions configuration in tox.ini.
- name: Test with tox
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ repos:
hooks:
- id: yesqa
- repo: https://github.com/pycqa/isort
rev: "5.10.1"
rev: "5.12.0"
hooks:
- id: isort
args: ["--profile", "black"]
Expand Down
6 changes: 5 additions & 1 deletion dbbackup/tests/test_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ def test_set_path(self):
@patch("dbbackup.settings.STORAGE", DEFAULT_STORAGE_PATH)
def test_set_options(self, *args):
storage = get_storage(options=STORAGE_OPTIONS)
self.assertEqual(storage.storage.__module__, "django.core.files.storage")
self.assertIn(
storage.storage.__module__,
# TODO: Remove "django.core.files.storage" case when dropping support for Django < 4.2.
("django.core.files.storage", "django.core.files.storage.filesystem"),
)


class StorageTest(TestCase):
Expand Down
2 changes: 1 addition & 1 deletion requirements/build.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
build
setuptools
tox
tox>=4.0.0
twine
wheel
2 changes: 1 addition & 1 deletion requirements/tests.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ python-dotenv
python-gnupg>=0.5.0
pytz
testfixtures
tox
tox>=4.0.0
tox-gh-actions
3 changes: 3 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ def get_test_requirements():
"Framework :: Django :: 2.2",
"Framework :: Django :: 3.2",
"Framework :: Django :: 4.0",
"Framework :: Django :: 4.1",
"Framework :: Django :: 4.2",
"Intended Audience :: Developers",
"Intended Audience :: System Administrators",
"License :: OSI Approved :: BSD License",
Expand All @@ -61,6 +63,7 @@ def get_test_requirements():
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Topic :: Database",
"Topic :: System :: Archiving",
"Topic :: System :: Archiving :: Backup",
Expand Down
17 changes: 10 additions & 7 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py{37,38,39}-django22,py{37,38,39,310}-django{32,40,master},lint,docs,functional
envlist = py{37,38,39}-django22,py{37,38,39,310,311}-django{32,40,41,42,master},lint,docs,functional

[testenv]
passenv = *
Expand All @@ -10,16 +10,19 @@ deps =
django22: django>=2.2,<2.3
django32: django>=3.2,<3.3
django40: django>=4.0,<4.1
django41: django>=4.1,<4.2
django42: django>=4.2,<4.3
djangomaster: https://github.com/django/django/archive/master.zip
commands = {posargs:coverage run runtests.py}

# Configure which test environments are run for each Github Actions Python version.
[gh-actions]
python =
3.7: py37-django{22,32},functional
3.8: py38-django{22,32,40},functional
3.9: py39-django{22,32,40},functional
3.10: py310-django{22,32,40},functional
3.8: py38-django{22,32,40,41,42},functional
3.9: py39-django{22,32,40,41,42},functional
3.10: py310-django{22,32,40,41,42},functional
3.11: py311-django{40,41,42},functional

[testenv:lint]
basepython = python
Expand All @@ -29,14 +32,14 @@ commands = prospector dbbackup -0

[testenv:docs]
basepython = python
whitelist_externals=make
allowlist_externals=make
deps = -rrequirements/docs.txt
commands = make docs

[testenv:functional]
basepython = python
passenv = *
whitelist_externals = bash
allowlist_externals = bash
deps =
-rrequirements/tests.txt
django
Expand All @@ -48,7 +51,7 @@ commands = {posargs:bash -x functional.sh}
[testenv:functional-mongodb]
basepython = python
passenv = *
whitelist_externals = bash
allowlist_externals = bash
deps =
-rrequirements/tests.txt
djongo
Expand Down

0 comments on commit 8f32a28

Please sign in to comment.