[TIP] Running a single test with tox

Aaron Whitehouse lists at whitehouse.kiwi.nz
Thu Jul 30 08:05:21 PDT 2015


I contribute to duplicity, which is a project that uses tox to make
run-tests run all tests against both Python version 2.6 and version 2.7.

I like to develop in a test-driven way, so am often running individual
tests or classes of tests, using (for example):
python setup.py test -s
(where the file holding the test is
[project]/testing/unit/test_selection.py, the class is MatchingTest and
the method is test_tuple_include)

When I use this command, however, it only tests against Python v2.7. It
would therefore be useful if I could ask tox to run the individual test,
so that it was tested against both Python 2.6 and 2.7.

I tried the command suggested here:
tox -e py26 --
but this ran all tests.

Similarly, following the directions on here:
tox -epy27 --  '(MatchingTest)'
also ran all tests.

And finally, following:
tox -e py27 -- testing.unit.test_selection.MatchingTest.test_tuple_include
tox -e py27 -- test_selection.MatchingTest.test_tuple_include
also runs all the tests.

(Note that I do not actually want to restrict the test to just py26 or
py27, but that is what all the examples do and so I thought I'd try to
get that working first.)

I'm presumably doing something really obvious wrong, but I can't figure
it out, so would really appreciate a pointer!

I'm running tox version 1.7.2.

Many thanks in advance,


More information about the testing-in-python mailing list