Handy Django Test Command Examples

Quick reference of the syntax for running different Django test commands. These were scooped from the excellent book Practical Django 2 and Channels 2 by Federico Marani

$ # Run all the views tests
$ ./manage.py test main.tests.test_views.TestPage

$ # Run the homepage test (specific test run)
$ ./manage.py test main.tests.test_views.TestPage.test_home_page_works

$ # Run all the tests
$ ./mange.py test

PRO TIPS:

--keepdb to keep test db between runs
--failfast to stop tests at first failure

Published by

alex

This is me.

Leave a Reply

Your email address will not be published. Required fields are marked *