[TIP] How do you run a specific Django unittest with Tox?

Marius Gedminas marius at gedmin.as
Sun Dec 27 02:45:28 PST 2015

On Sat, Dec 26, 2015 at 02:12:31PM -0500, Chris Spencer wrote:
> I'm trying to wrap Tox around some Django unittests, and I can run all
> unittests with Tox by calling:
>     django-admin.py test --settings=myapp.tests.settings myapp.tests.Tests
> However, I'd like to run a specific test at
> myapp.tests.Tests.test_somespecificthing, but I can't figure out how pass
> in a custom command-line option and use that to change the command Tox runs.

You can use {posargs}, e.g


  commands =
     django-admin.py test --settings=blahblah {posargs}

and then

  tox -e py27 -- myapp/tests.py:Tests.test_somespecificthing

(or whatever)

Marius Gedminas
Programs that write programs are the happiest programs in the world.
        -- Andrew Hume
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 173 bytes
Desc: Digital signature
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20151227/6cf86790/attachment.pgp>

More information about the testing-in-python mailing list