← Back to Django Course | Chapter 13: Testing in Django | Lesson 7 of 9

Running Tests with manage.py

python manage.py test is the single command that tells Django to go find every test in your project and run them all.

Running the full test suite

The simplest invocation runs every discovered test across all apps in the project.

Example: Running the full test suite

The simplest invocation runs every discovered test across all apps in the project.

bash
python manage.py test

⚠️ Run this command in your terminal.

Running tests for one app

Narrowing the command to a single app's dotted path speeds up the feedback loop while working on that app.

Example: Running tests for one app

Narrowing the command to a single app's dotted path speeds up the feedback loop while working on that app.

bash
python manage.py test myapp

⚠️ Run this command in your terminal.

Running a single test method

A fully dotted path down to the method lets you re-run just the test you're actively debugging.

Example: Running a single test method

A fully dotted path down to the method lets you re-run just the test you're actively debugging.

bash
python manage.py test myapp.tests.BookModelTests.test_book_title_saved

⚠️ Run this command in your terminal.

Common Mistakes
  1. Running tests against the real development database by mistake — Django always creates a separate test database automatically, so this fear is misplaced but confuses beginners who don't realize it.
  2. Not narrowing the test command to one app while debugging, making the feedback loop slower than necessary.
  3. Ignoring a skipped or errored test in the output instead of investigating why it did not run.
Chapter Summary
  • python manage.py test discovers and runs every test in every installed app.
  • You can target a specific app, class, or method with dotted paths.
  • The command prints a dot per passing test and a full traceback per failure.
  • A summary line at the end reports how many tests ran, and whether they all passed.

Login to run this code

C/C++/Java/PHP execution requires a free account. Your code is saved — you'll land right back in the editor after logging in.