]> git.ipfire.org Git - thirdparty/suricata-update.git/commitdiff
testing: use tox for unit tests
authorJason Ish <ish@unx.ca>
Wed, 6 Dec 2017 20:36:23 +0000 (14:36 -0600)
committerJason Ish <ish@unx.ca>
Thu, 7 Dec 2017 22:01:31 +0000 (16:01 -0600)
Tox can test against multiple versions of Python using
virtualenvs.

.gitignore
Makefile
tox.ini [new file with mode: 0644]

index 17b6cf9c93a33c11e93e53428b427109df709efd..45156795a3372534873b7349302ba90a217f6670 100644 (file)
@@ -10,3 +10,6 @@ _work
 
 # The file containing the git revision.
 /suricata/update/revision.py*
+
+# Working files for the tox testing framework.
+/.tox
index 9987847f78349cd70210ab300ed766ecf5539c74..0dd08b0374edde2fe888f08a85810456f0b6d1e8 100644 (file)
--- 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 (file)
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