diff --git a/.coveragerc b/.coveragerc index 02b787e9..4664e2bc 100644 --- a/.coveragerc +++ b/.coveragerc @@ -7,5 +7,6 @@ omit = **/tests/*.py env* settings.py + conftest.py local_settings.py /home/travis/virtualenv* diff --git a/.gitignore b/.gitignore index e047ef4a..b6abcfbc 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,4 @@ env/ # coverage .coverage +htmlcov diff --git a/.travis.yml b/.travis.yml index 03bb6f46..c06a474a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,9 +6,9 @@ cache: pip install: "pip install -r requirements.txt && pip install coveralls pylint" script: - - python manage.py collectstatic --noinput - - coverage run --rcfile .coveragerc manage.py test - - pylint devel main mirrors news packages releng templates todolists visualize *.py + - make collectstatic + - make lint + - make coverage after_success: - coveralls diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..baa6a826 --- /dev/null +++ b/Makefile @@ -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 + +lint: + pylint devel main mirrors news packages releng templates todolists visualize *.py + +collecstatic: + python manage.py collecstatic --noinput + +test: test-py + +test-py coverage: + ${PYTEST} ${PYTEST_INPUT} ${PYTEST_OPTIONS} ${PYTEST_COVERAGE_OPTIONS} + +open-coverage: coverage + ${BROWSER} htmlcov/index.html diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 00000000..4e22ea20 --- /dev/null +++ b/pytest.ini @@ -0,0 +1,2 @@ +[pytest] +DJANGO_SETTINGS_MODULE = settings