Skip to content

Commit

Permalink
Add pytest integration files
Browse files Browse the repository at this point in the history
  • Loading branch information
jelly committed Aug 4, 2019
1 parent a3f3403 commit 0a1f1fc
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 3 deletions.
1 change: 1 addition & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ omit =
**/tests/*.py
env*
settings.py
conftest.py
local_settings.py
/home/travis/virtualenv*
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ env/

# coverage
.coverage
htmlcov
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
32 changes: 32 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[pytest]
DJANGO_SETTINGS_MODULE = settings

0 comments on commit 0a1f1fc

Please sign in to comment.