diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 0000000..0814f7a --- /dev/null +++ b/.coveragerc @@ -0,0 +1,6 @@ +[run] +branch = true +source = sendfile +omit = + */_version.py + */tests.py diff --git a/.gitignore b/.gitignore index 59aaba9..6936d49 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,5 @@ /build .Python .tox +/examples/protected_downloads/htmlcov +/examples/protected_downloads/.coverage diff --git a/.travis.yml b/.travis.yml index 26995c4..3f05467 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,9 +11,14 @@ python: - pypy2.7-6.0 - pypy3.5-6.0 -install: travis_retry pip install -q tox -script: tox -e py # run tox for the current version of Python +install: pip install tox-travis codecov + +script: tox + +after_success: + - cd examples/protected_downloads + - codecov matrix: include: diff --git a/tox.ini b/tox.ini index 2fa9815..306b2eb 100644 --- a/tox.ini +++ b/tox.ini @@ -1,8 +1,10 @@ [tox] envlist = + clean py{py,27,py3,35,36,37}-django111 py{py3,35,36,37,38}-django{21,22} flake8 + coverage [testenv] usedevelop=True @@ -10,11 +12,33 @@ deps = django111: Django>=1.11,<1.12 django21: Django>=2.1,<2.2 django22: Django>=2.2,<2.3 + coverage changedir = examples/protected_downloads commands = python --version - python manage.py test sendfile {posargs} + coverage run --rcfile=../../.coveragerc -a manage.py test sendfile {posargs} +[travis] +python = + pypy: clean,pypy,coverage + pypy3: clean,pypy3,coverage + 2.7: clean,py27,coverage + 3.5: clean,py35,coverage + 3.6: clean,py36,coverage + 3.7: clean,py37,coverage + 3.8: clean,py38,coverage + +[testenv:clean] +basepython = python3 +deps = coverage +commands = coverage erase + +[testenv:coverage] +basepython = python3 +deps = coverage +commands = + coverage report + coverage html [testenv:flake8] basepython=python