Skip to content

Commit

Permalink
Tweak test config and add coverage.
Browse files Browse the repository at this point in the history
  • Loading branch information
amanning9 committed Mar 27, 2024
1 parent 9b80f77 commit ac5d9a1
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ __pycache__
.DS_Store
.tox
poetry.lock
.coverage
15 changes: 15 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ django-filter = {version = "^24.1", optional = true}
drf-spectacular = {version="^0.27.1", optional = true}
drf-spectacular-sidecar = {version="^2024.1.1", optional = true}
python-keycloak = {version = "^3.2.0", optional = true}
setuptools = "^69.2.0" # Setuptools is a dependency of django-countries. See https://github.com/SmileyChris/django-countries/issues/442 for details.

[tool.poetry.extras]
api = ["djangorestframework", "django-filter", "drf-spectacular", "drf-spectacular-sidecar"]
Expand All @@ -41,9 +42,11 @@ mypy = "^1.2.0"
types-python-dateutil = "^2.8.19.12"
django-stubs = {extras = ["compatible-mypy"], version = "^4.2.0"}
pylint-django = "^2.5.5"
bandit = "^1.7.8"

[tool.poetry.group.test.dependencies]
django-oauth-toolkit = "^1.7.0"
coverage = "^7.4.4"

[tool.black]
line-length = 100
Expand All @@ -69,6 +72,18 @@ load-plugins = 'pylint_django'
[tool.pylint.'MESSAGES CONTROL']
disable = ['too-few-public-methods', 'missing-class-docstring']

[tool.coverage.run]
branch = true
include = [
"jasmin_services/*",
]

[tool.coverage.report]
show_missing = true
skip_empty = true
skip_covered = true
fail_under = 40

[build-system]
requires = ["poetry-core>=1.0.0", "setuptools>=59.6.0"]
build-backend = "poetry.core.masonry.api"
18 changes: 14 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ envlist = py310,py311,py312
[gh]
python =
3.10 = py310
3.11 = py311
3.11 = py311,black,bandit,coverage
3.12 = py312

[testenv]
skip_install = true
setenv =
DJANGO_SETTINGS_MODULE=tests.settings
PYTHONPATH=$TOX_WORK_DIR/..
PYTHONWARNINGS=always
#PYTHONWARNINGS=always
allowlist_externals =
poetry
commands_pre =
Expand All @@ -22,9 +22,19 @@ commands =
django-admin check
django-admin test --parallel {posargs}

[testenv:coverage]
commands =
coverage erase
coverage run -m django test
coverage report

[testenv:black]
docker=
skip_install=True
commands_pre=
poetry install --sync --only=dev --all-extras
commands = black --check --fast .

[testenv:bandit]
commands_pre=
poetry install --sync --only=dev --all-extras
commands =
bandit -c pyproject.toml -r --severity-level high jasmin_services

0 comments on commit ac5d9a1

Please sign in to comment.