From cb3128966983c26d747bee1e6a79242e9512c21f Mon Sep 17 00:00:00 2001 From: Ruben Pollan Date: Thu, 26 Jan 2017 20:09:04 +0100 Subject: [test] run the tests with tox and py.test - Resolves: #14 --- .gitignore | 3 ++- README.md | 14 ++++++++++++++ pkg/requirements-testing.pip | 6 ++++++ setup.cfg | 20 ++++++++++++++++---- tox.ini | 14 ++++++++++++++ 5 files changed, 52 insertions(+), 5 deletions(-) create mode 100644 tox.ini diff --git a/.gitignore b/.gitignore index 173cac5..dc8af53 100644 --- a/.gitignore +++ b/.gitignore @@ -25,9 +25,10 @@ PKG-INFO pip-log.txt # Unit test / coverage reports +docs/cov_html/ .coverage .tox -nosetests.xml +.cache # Translations *.mo diff --git a/README.md b/README.md index c78b14b..cd55f6d 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,20 @@ Please use that for bug reports and feature requests instead of github's tracker. We're using github for code commenting and review between collaborators. +### Running Tests + +You need tox to run the tests. If you don't have it in your system yet:: + +~~~ +$ pip install tox +~~~ + +And then run all the tests:: + +~~~ +$ tox +~~~ + ## Issues * see the [Changelog](./CHANGELOG) for details of all major changes in the different versions diff --git a/pkg/requirements-testing.pip b/pkg/requirements-testing.pip index 94b8e9c..322f1e8 100644 --- a/pkg/requirements-testing.pip +++ b/pkg/requirements-testing.pip @@ -1,2 +1,8 @@ pep8 +flake8 +coverage +pytest +pytest-pep8 +pytest-cov +pytest-pdb setuptools-trial diff --git a/setup.cfg b/setup.cfg index d8a5cc1..b58cc41 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,9 +1,6 @@ -[aliases] -test = trial - [pep8] exclude = versioneer.py,_version.py,*.egg,build,dist,docs -ignore = E731 +ignore = E731 E402 [flake8] exclude = versioneer.py,_version.py,*.egg,build,dist,docs @@ -15,3 +12,18 @@ style = pep440 versionfile_source = src/leap/mx/_version.py versionfile_build = leap/mx/_version.py tag_prefix = + +[tool:pytest] +pep8ignore = + * E731 E402 + docs/conf.py ALL + versioneer.py ALL + _version.py ALL + *.egg ALL + *_rc.py ALL + +[coverage:run] +branch = True + +[coverage:html] +directory = doc/cov_html diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..417bd18 --- /dev/null +++ b/tox.ini @@ -0,0 +1,14 @@ +[tox] +envlist = py27 +skipsdist=True + +[testenv] +commands = py.test --cov-report=html \ + --cov-report=term \ + --cov=leap.mx \ + --pep8 {posargs} +usedevelop = True +deps = + -r{toxinidir}/pkg/requirements-testing.pip +setenv = + HOME=/tmp -- cgit v1.2.3