ci: update tox.ini & precommit hooks & compatibility py311 (#86370)

This commit is contained in:
Benjamin Dauvergne 2024-01-31 16:11:22 +01:00
parent f8934ee59c
commit f98e0560da
3 changed files with 73 additions and 21 deletions

View File

@ -5,8 +5,40 @@ repos:
rev: v4.4.0
hooks:
- id: double-quote-string-fixer
- repo: https://github.com/asottile/pyupgrade
rev: v3.3.1
hooks:
- id: pyupgrade
args: ['--keep-percent-format', '--py39-plus']
- repo: https://github.com/adamchainz/django-upgrade
rev: 1.13.0
hooks:
- id: django-upgrade
args: ['--target-version', '3.2']
- repo: https://github.com/psf/black
rev: 22.3.0
rev: 23.1.0
hooks:
- id: black
args: ['--target-version', 'py37', '--skip-string-normalization', '--line-length', '110']
args: ['--target-version', 'py39', '--skip-string-normalization', '--line-length', '110']
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort
args: ['--profile', 'black', '--line-length', '110']
- repo: https://github.com/rtts/djhtml
rev: '3.0.5'
hooks:
- id: djhtml
args: ['--tabwidth', '2']
- repo: https://git.entrouvert.org/pre-commit-debian.git
rev: v0.3
hooks:
- id: pre-commit-debian
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.1.15
hooks:
# Run the linter.
- id: ruff
exclude: 'debian/.*|benchmark'
args: [ --fix ]

10
test-requirements.txt Normal file
View File

@ -0,0 +1,10 @@
# M2Crypto
psycopg2-binary
mock
beautifulsoup4
# pytz
pytest
pytest-cov
pytest-django
django-webtest
beautifulsoup4

48
tox.ini
View File

@ -1,25 +1,15 @@
[tox]
toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/docbow/{env:BRANCH_NAME:}
envlist = py3-django32-{pw,pfwb}-coverage,py3-django32-mellon-coverage,py3-django32-pfwbmellon-coverage, black
envlist = {pw,pfwb,mellon,pfwbmellon},codestyle
[testenv]
usedevelop = True
deps =
setuptools<50
M2Crypto
django32: django>=3.2.12,<3.3
django>=3.2.12,<3.3
pfwb: SQLAlchemy-Utils<0.36.7
django-webtest
mock<4
psycopg2<2.9
pytest
pytest-cov
pytest-django
pytz
mellon: django-mellon
pfwbmellon: django-mellon
py3: beautifulsoup4
pre-commit
-r test-requirements.txt
setenv =
SECRET_KEY=changeme
pw: PARLEMENT=pw
@ -28,12 +18,32 @@ setenv =
DOCBOW_SETTINGS_FILE=tests/settings.py
mellon: DOCBOW_SETTINGS_FILE=tests/sso/settings.py
pfwbmellon: DOCBOW_SETTINGS_FILE=tests/pfwbmellon/settings.py
coverage: COVERAGE=--cov-append --cov-report xml --cov-report html --cov=docbow_project/ --cov-config .coveragerc
JUNIT={tty::-o junit_suite_name={envname} --junit-xml=junit-{envname}.xml}
COVERAGE={tty::--cov --cov-append --cov-report xml --cov-report html --cov-context=test --cov-config=tox.ini}
BRANCH_NAME={env:BRANCH_NAME:}
pw: TESTFILES=tests/main/ tests/pw/
pfwb: TESTFILES=tests/main/ tests/pfwb/
mellon: TESTFILES=tests/sso/
pfwbmellon: TESTFILES=tests/pfwbmellon/
allowlist_externals =
./getlasso3.sh
commands =
./getlasso3.sh
pw: py.test {posargs: {env:COVERAGE:} --junitxml=junit-{envname}.xml tests/main/ tests/pw/}
pfwb: py.test {posargs: {env:COVERAGE:} --junitxml=junit-{envname}.xml tests/main/ tests/pfwb/}
mellon: py.test {posargs: {env:COVERAGE:} --junitxml=junit-{envname}.xml tests/sso/}
pfwbmellon: py.test {posargs: {env:COVERAGE:} --junitxml=junit-{envname}.xml tests/pfwbmellon/}
black: pre-commit run black --all-files --show-diff-on-failure
py.test {env:JUNIT:} {env:COVERAGE:} {posargs:{env:TESTFILES:}}
[testenv:codestyle]
skip_install = true
deps =
pre-commit
commands =
pre-commit run --all-files --show-diff-on-failure
[coverage:run]
source =
dowbow_project
tests
tests_sso
branch = True
[coverage:html]
show_contexts = True