From e7f574fb7cb4eaf006c995484b7e48dbfcda81b2 Mon Sep 17 00:00:00 2001 From: Filip Valder Date: Jan 17 2018 08:36:51 +0000 Subject: Introduce some basic tox... --- diff --git a/.gitignore b/.gitignore index edd359e..4499c99 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +/.coverage* +/.tox/ *.pyc *.pyo modulemd.egg-info diff --git a/README.rst b/README.rst index 78dd93d..49abe66 100644 --- a/README.rst +++ b/README.rst @@ -14,3 +14,12 @@ library for the manipulation thereof. modulemd: A python library for manipulation of the proposed module metadata format. API documentation is available at http://modulemd.readthedocs.org/. + +Testing +------- + +.. code-block:: bash + + $ tox -e py27,py35 + +*See tox.ini for additional environments.* diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..410db77 --- /dev/null +++ b/tox.ini @@ -0,0 +1,41 @@ +# Tox (http://tox.testrun.org/) is a tool for running tests +# in multiple virtualenvs. This configuration file will run the +# test suite on all supported python versions. To use it, "pip install tox" +# and then run "tox" from this directory. + +[tox] +envlist = py27, py35, coverage, flake8, bandit + +[flake8] +max-line-length = 100 + +[testenv] +usedevelop = true +deps = pytest +commands = + py.test {posargs} + +[testenv:coverage] +basepython = python2 +deps = + {[testenv]deps} + coverage +commands = + coverage run --parallel-mode -m pytest + coverage combine + coverage report --omit=.tox/* -m --skip-covered + +[testenv:flake8] +basepython = python3 +skip_install = true +deps = flake8 +commands = flake8 --ignore E731 --exclude .tox,.git +ignore_outcome = True + +[testenv:bandit] +basepython = python3 +skip_install = true +deps = bandit +commands = + /bin/bash -c "bandit -r -ll $(find . -mindepth 1 -maxdepth 1 ! -name \.\* -type d -o -name \*.py)" +ignore_outcome = True