[Piglit] [PATCH 5/7] framework: add tox testing support

baker.dylan.c at gmail.com baker.dylan.c at gmail.com
Thu Oct 8 14:49:45 PDT 2015


From: Dylan Baker <baker.dylan.c at gmail.com>

tox is a python test manager that runs the tests in isolated
environments with their own copies of dependent libraries, and can be
used to test against multiple versions of python. This allows us to
easily test the framework with and without the acceleration modules it
can optionally use (simplejson and lxml), it will also allow us to test
against multiple versions of python 3.x (which we support for the
generators, and presumably will support in the future)

This uses the coverage module, and uses nose's cover-tests option.
Unfortunately nose assumes that anything /[Tt]est/ is a test, and hides
the tests for the test package. This might be resolvable by modifying
the regex, but it isn't something straightforward to fix. Using
--cover-tests will get us the test package, but it also gets us the
tests package.

Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
 .gitignore |  1 +
 README     |  2 ++
 tox.ini    | 16 ++++++++++++++++
 3 files changed, 19 insertions(+)
 create mode 100644 tox.ini

diff --git a/.gitignore b/.gitignore
index 6030aaf..0f985bb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -24,6 +24,7 @@ tests/glslparsertest/glslcompiler
 generated_tests/cl
 
 .makotmp
+.tox/
 
 *.css
 *.html
diff --git a/README b/README
index 8bbb72d..be8f4df 100644
--- a/README
+++ b/README
@@ -42,6 +42,8 @@ Optionally, you can install the following:
 
   - nose. A python test framework, used for running the python framework
     test suite. (https://nose.readthedocs.org/en/latest/)
+  - tox. A tool for testing python packages against multiple configurations of
+    python (https://tox.readthedocs.org/en/latest/index.html)
   - lxml. An accelerated python xml library using libxml2 (http://lxml.de/)
   - simplejson. A fast C based implementation of the python json library.
     (https://simplejson.readthedocs.org/en/latest/)
diff --git a/tox.ini b/tox.ini
new file mode 100644
index 0000000..c29014c
--- /dev/null
+++ b/tox.ini
@@ -0,0 +1,16 @@
+[tox]
+envlist = py27-{noaccel,accel}
+skipsdist=True
+
+[testenv]
+deps =
+    mako
+    numpy
+    six
+    nose
+    coverage
+    accel: simplejson
+    accel: lxml
+    accel: backports.lzma
+passenv=HOME
+commands = nosetests framework/tests --attr="!privliged" --with-cover --cover-package=framework --cover-tests
-- 
2.6.1



More information about the Piglit mailing list