Add tox as a test runner.

This commit adds tox as the Tahrir test runner. It ensures that
the unit tests pass, that new code has test coverage, and that the
docs build.

Signed-off-by: Randy Barlow <randy@electronsweatshop.com>
This commit is contained in:
Randy Barlow 2019-01-21 14:10:06 +01:00 committed by Randy Barlow
parent 99ce3f042f
commit 21d4b8f4a1
5 changed files with 56 additions and 7 deletions

10
.coveragerc Normal file
View File

@ -0,0 +1,10 @@
[run]
branch = True
source = tahrir
[report]
precision = 2
fail_under = 5.2
exclude_lines =
pragma: no cover
show_missing = True

5
.gitignore vendored
View File

@ -1,7 +1,12 @@
*.swp
*.pyc
*.pyo
.coverage
.tox
coverage.xml
data
docs/_build
htmlcov
*.swo
*.db
*.db-journal

View File

@ -164,6 +164,15 @@ following command:
Once that is running, simply go to http://localhost:8000/ in your browser on
your host to see your running tahrir test instance.
Run the tests
-------------
You can use ``tox`` to run the tests::
$ tox
Windows (32 and 64 bit versions):
---------------------------------

View File

@ -1,10 +1,3 @@
[nosetests]
match=^test
nocapture=1
cover-package=tahrir
with-coverage=1
cover-erase=1
[compile_catalog]
directory = tahrir/locale
domain = tahrir
@ -25,3 +18,6 @@ domain = tahrir
input_file = tahrir/locale/tahrir.pot
output_dir = tahrir/locale
previous = true
[tool:pytest]
addopts = --cov-config .coveragerc --cov=tahrir --cov-report term --cov-report xml --cov-report html

29
tox.ini Normal file
View File

@ -0,0 +1,29 @@
[tox]
envlist = py27,diff-cover,docs
# If the user is missing an interpreter, don't fail
skip_missing_interpreters = True
[testenv]
deps =
pytest
pytest-cov
commands =
py.test
passenv = HOME
[testenv:diff-cover]
deps =
diff-cover
commands =
diff-cover coverage.xml --compare-branch=origin/develop --fail-under=100
[testenv:docs]
changedir = docs
deps =
sphinx
whitelist_externals =
mkdir
sphinx-build
commands=
mkdir -p _static
sphinx-build -W -b html -d {envtmpdir}/doctrees . _build/html