Web Dev

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


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