Skip to content

Commit

Permalink
Support Django v4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
hongquan committed Jul 19, 2023
1 parent 37bfa49 commit c1269b4
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 36 deletions.
11 changes: 4 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,17 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/setup-python@v1
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- uses: Gr1N/setup-poetry@v4
with:
poetry-version: 1.1.4
- name: Install Poetry
uses: abatilo/actions-poetry@v2
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions
- name: Test with tox
run: tox
env:
PLATFORM: ${{ matrix.platform }}
strategy:
matrix:
python-version: [3.6, 3.7, 3.8]
python-version: [3.8, 3.9, '3.10', 3.11]
59 changes: 49 additions & 10 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "dj-static-revision"
version = "0.5"
version = "0.6"
description = "Revision info for Django static file"
authors = ["Nguyễn Hồng Quân <[email protected]>"]
license = "Apache-2.0"
Expand All @@ -10,24 +10,63 @@ readme = "README.rst"
keywords = ["django", "static", "version", "cache"]
classifiers = [
"Framework :: Django",
"Framework :: Django :: 2.2",
"Framework :: Django :: 3.0",
"Framework :: Django :: 3.2",
"Framework :: Django :: 3.1",
"Framework :: Django :: 3.2",
"Framework :: Django :: 4.0",
"Framework :: Django :: 4.1",
"Framework :: Django :: 4.2",
"Environment :: Web Environment",
"Topic :: Software Development :: Libraries :: Python Modules"
]

[tool.poetry.dependencies]
python = "^3.7"
dulwich = "^0.19.15"
python = "^3.8"
dulwich = "^0.21.5"
single-version = "^1.5.1"
django = "<4.3"

[tool.poetry.group.dev.dependencies]
pytest = "^7.4.0"
pytest-env = "^0.8.2"


[tool.poetry.group.lint.dependencies]
ruff = "^0.0.278"

[tool.ruff]
line-length = 120

target-version = "py310"

exclude = [
".bzr",
".direnv",
".eggs",
".git",
".hg",
".mypy_cache",
".nox",
".pants.d",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"venv",
"*/migrations/*",
"*/static/CACHE/*",
]

[tool.poetry.dev-dependencies]
pytest = "^7.1.2"
pytest-flake8 = "^1.1.1"
[tool.ruff.per-file-ignores]
"tests/test_dj_static_revision.py" = ["E402"]

[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
2 changes: 1 addition & 1 deletion pytest.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[pytest]
addopts = --doctest-modules --flake8
addopts = --doctest-modules
env =
DJANGO_SETTINGS_MODULE=tests.django_settings
testpaths = tests dj_static_revision
Expand Down
1 change: 1 addition & 0 deletions tests/django_settings.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
SECRET_KEY = 'Thanh xay khoi biec, non phoi bong vang'
USE_TZ = True
8 changes: 4 additions & 4 deletions tests/test_dj_static_revision.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
from pathlib import Path

os.environ.setdefault('DJANGO_SETTINGS_MODULE',
'tests.django_settings') # NOQA
'tests.django_settings')

import django
django.setup() # NOQA
django.setup()

from dulwich.repo import Repo
from dulwich.errors import NotGitRepository
Expand All @@ -17,7 +17,7 @@


class TestGetSourceRevision:
def setup(self):
def setup_method(self):
self.original_revision = None

def test_normal_from_file(self):
Expand Down Expand Up @@ -46,7 +46,7 @@ def test_normal_from_repo(self):
v = get_source_revision()
assert v == version[:10]

def teardown(self):
def teardown_method(self):
folder = Path.cwd()
try:
(folder / '.version').unlink()
Expand Down
26 changes: 12 additions & 14 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
[tox]
skipsdist=True
envlist=
test-py{36,37}-dj22
test-py{36,37,38}-dj30
test-py{37,38}-dj31
test-py{38,39}-dj32
test-py{39,310}-dj40
test-py{39,310}-dj41
test-py{310,311}-dj42

[testenv]
deps=
py36: pip >= 20
dj22: Django>=2.2,<2.3
dj30: Django>=3.0,<3.1
dj31: Django>=3.1,<3.2
test: pytest-flake8
dj32: Django>=3.2,<4
dj40: Django>=4.0,<4.1
dj41: Django>=4.1,<4.2
dj42: Django>=4.2,<4.3
test: pytest
skip_install=true
whitelist_externals=sh
commands=
Expand All @@ -20,10 +21,7 @@ commands=

[gh-actions]
python =
3.6: py36
3.7: py37
3.8: py38

[flake8]
max_line_length = 120
ignore = W503 E402
3.9: py39
3.10: py310
3.11: py311

0 comments on commit c1269b4

Please sign in to comment.