Add a makefile for running tests
Switch to pytest for running test as it has better fixtures then django has by default.
This commit is contained in:
parent
d36547f1a2
commit
b41222d50e
8
.github/workflows/main.yml
vendored
8
.github/workflows/main.yml
vendored
@ -16,13 +16,13 @@ jobs:
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install -r requirements.txt && pip install coveralls flake8
|
||||
pip install -r requirements.txt && pip install flake8 pytest pytest-cov pytest-django
|
||||
- name: Lint with flake8
|
||||
run: |
|
||||
flake8 --exclude "*/migrations/" devel main mirrors news packages releng templates todolists visualize *.py
|
||||
make lint
|
||||
- name: Run collectstatic
|
||||
run: |
|
||||
python manage.py collectstatic --noinput
|
||||
make collectstatic
|
||||
- name: Run tests
|
||||
run: |
|
||||
coverage run --rcfile .coveragerc manage.py test
|
||||
make coverage
|
||||
|
32
Makefile
Normal file
32
Makefile
Normal file
@ -0,0 +1,32 @@
|
||||
PYTHON>=python
|
||||
PYTEST?=pytest
|
||||
PYTEST_OPTIONS+=
|
||||
PYTEST_INPUT?=.
|
||||
PYTEST_COVERAGE_OPTIONS+=--cov-report=term-missing --cov-report=html:htmlcov --cov=.
|
||||
PYTEST_PDB?=0
|
||||
PYTEST_PDB_OPTIONS?=--pdb --pdbcls=IPython.terminal.debugger:TerminalPdb
|
||||
|
||||
|
||||
ifeq (${PYTEST_PDB},1)
|
||||
PYTEST_OPTIONS+= ${PYTEST_PDB_OPTIONS}
|
||||
else
|
||||
test-pdb: PYTEST_OPTIONS+= ${PYTEST_PDB_OPTIONS}
|
||||
endif
|
||||
test-pdb: test
|
||||
|
||||
|
||||
.PHONY: test lint coverage
|
||||
|
||||
lint:
|
||||
flake8 --extend-exclude "*/migrations/,local_settings.py" devel main mirrors news packages releng templates todolists visualize *.py
|
||||
|
||||
collectstatic:
|
||||
python manage.py collectstatic --noinput
|
||||
|
||||
test: test-py
|
||||
|
||||
test-py coverage:
|
||||
DJANGO_SETTINGS_MODULE=settings ${PYTEST} ${PYTEST_OPTIONS} ${PYTEST_COVERAGE_OPTIONS} ${PYTEST_INPUT}
|
||||
|
||||
open-coverage: coverage
|
||||
${BROWSER} htmlcov/index.html
|
Loading…
Reference in New Issue
Block a user