Skip to content
Snippets Groups Projects
Commit 5d52c80d authored by Deaktivert bruker's avatar Deaktivert bruker
Browse files

build: replace Django unittest runner with pytest

Pytest understands unittest-styled tests, so there is no immediate
need to update the test files themselves to a pytest idiomatic
syntax.

Fixes: GREG-14
parent 78545934
No related branches found
No related tags found
1 merge request!11greg.tests: migrate to pytest test runner
DJANGO_SETTINGS_MODULE ?= gregsite.settings.dev
BLACK ?= black -q BLACK ?= black -q
MYPY ?= mypy MYPY ?= mypy
PIP ?= pip -q PIP ?= pip -q
POETRY ?= poetry POETRY ?= poetry
PYLINT ?= pylint -sn PYLINT ?= pylint -sn
PYTEST ?= pytest -v -s --no-header
PYTHON ?= python3.9 PYTHON ?= python3.9
VENV ?= venv VENV ?= venv
mypy = $(MYPY) --config-file mypy.ini mypy = $(MYPY) --config-file mypy.ini
pip = python -m $(PIP) pip = python -m $(PIP)
poetry = python -m $(POETRY) poetry = python -m $(POETRY)
pytest = DJANGO_SETTINGS_MODULE=$(DJANGO_SETTINGS_MODULE) python -m $(PYTEST)
venv = . $(VENV)/bin/activate && venv = . $(VENV)/bin/activate &&
PACKAGES = greg/ gregsite/ PACKAGES = greg/ gregsite/
...@@ -30,7 +34,7 @@ $(VENV)/touchfile: ...@@ -30,7 +34,7 @@ $(VENV)/touchfile:
.PHONY: test .PHONY: test
test: $(VENV) test: $(VENV)
$(venv) $(mypy) -p greg $(venv) $(mypy) -p greg
$(venv) python manage.py test $(venv) $(pytest)
.PHONY: lint .PHONY: lint
lint: $(VENV) lint: $(VENV)
......
...@@ -28,6 +28,7 @@ ipython = "*" ...@@ -28,6 +28,7 @@ ipython = "*"
mypy = "*" mypy = "*"
pylint = "*" pylint = "*"
pylint-django = "*" pylint-django = "*"
pytest-django = "^4.4.0"
rope = "*" rope = "*"
[tool.black] [tool.black]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment