From: Jason Ish Date: Wed, 6 Dec 2017 20:36:23 +0000 (-0600) Subject: testing: use tox for unit tests X-Git-Tag: 1.0.0b1~31 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5aef80b4835d333297fd3b61c1ee8ccca376e8b5;p=thirdparty%2Fsuricata-update.git testing: use tox for unit tests Tox can test against multiple versions of Python using virtualenvs. --- diff --git a/.gitignore b/.gitignore index 17b6cf9..4515679 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,6 @@ _work # The file containing the git revision. /suricata/update/revision.py* + +# Working files for the tox testing framework. +/.tox diff --git a/Makefile b/Makefile index 9987847..0dd08b0 100644 --- a/Makefile +++ b/Makefile @@ -9,16 +9,11 @@ install: python setup.py install test: - @if which nosetests-3 2>&1 > /dev/null; then \ - echo "Running nosetests-3."; \ - nosetests-3; \ + @if ! which tox 2>&1 > /dev/null; then \ + echo "error: tox required to run tests"; \ + exit 1; \ fi - @if which nosetests-2 2>&1 > /dev/null; then \ - echo "Running nosetests-2."; \ - nosetests-2; \ - fi - @echo "Running nosetests." - @nosetests + @tox clean: find . -name \*.pyc -print0 | xargs -0 rm -f diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..33dc40a --- /dev/null +++ b/tox.ini @@ -0,0 +1,13 @@ +# Tox (https://tox.readthedocs.io/) 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, py34, py35, py36 + +[testenv] +commands = pytest +deps = + pytest + pyyaml