From 5f85b79d56f338ef77ef7ff719a73815435fdf34 Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Tue, 7 Jul 2015 12:47:16 +0200 Subject: Automatic testing with py.test, coverage and tox The patch provides test automation with tox. Just run 'tox' in the source root to create virtual envs, install custodia from the sources and run the tests on Python 2.7 and 3.4. Signed-off-by: Christian Heimes Reviewed-by: Simo Sorce Closes: #4 --- .coveragerc | 23 +++++++++++++++++++++++ .gitignore | 2 ++ conftest.py | 1 + tox.ini | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 86 insertions(+) create mode 100644 .coveragerc create mode 100644 conftest.py create mode 100644 tox.ini diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 0000000..1fb28af --- /dev/null +++ b/.coveragerc @@ -0,0 +1,23 @@ +[run] +branch = True +source = + custodia + tests + +[paths] +source = + custodia + .tox/*/lib/python*/site-packages/custodia + +[report] +ignore_errors = False +precision = 1 +exclude_lines = + pragma: no cover + raise AssertionError + raise NotImplementedError + if 0: + if False: + if __name__ == .__main__.: + if PY3 + if not PY3 diff --git a/.gitignore b/.gitignore index d489600..9df8310 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,6 @@ dist/ *.pyc *.pyo cscope.out +.tox +.coverage MANIFEST diff --git a/conftest.py b/conftest.py new file mode 100644 index 0000000..8f94a35 --- /dev/null +++ b/conftest.py @@ -0,0 +1 @@ +collect_ignore = ["setup.py", "custodia/custodia"] diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..0e3dea0 --- /dev/null +++ b/tox.ini @@ -0,0 +1,60 @@ +[tox] +envlist = py27,py34,doc,sphinx + +[testenv] +deps = + pytest + coverage + -r{toxinidir}/requirements.txt + cryptography +commands = + coverage run -m pytest --capture=no --strict {posargs} + coverage report -m + +[testenv:pep8] +basepython = python2.7 +deps = + flake8 + flake8-import-order + pep8-naming +commands = + flake8 {posargs} + +[testenv:py3pep8] +basepython = python3.4 +deps = + flake8 + flake8-import-order + pep8-naming +commands = + flake8 {posargs} + +[testenv:doc] +deps = + doc8 + docutils + markdown +basepython = python2.7 +commands = + doc8 --allow-long-titles README + python setup.py check --restructuredtext --metadata --strict + markdown_py README.md -f {toxworkdir}/README.md.html + markdown_py API.md -f {toxworkdir}/API.md.html + +[testenv:sphinx] +basepython = python2.7 +changedir = docs/source +deps = + sphinx < 1.3.0 +commands = + sphinx-build -v -W -b html -d {envtmpdir}/doctrees . {envtmpdir}/html + +[pytest] +python_files = tests/*.py custodia/*.py + +[flake8] +exclude = .tox,*.egg,dist,build,docs/source +show-source = true +max-line-length = 79 +ignore = N802 +application-import-names = custodia -- cgit