| Skip to main content | https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#main-content |
| Django | https://www.djangoproject.com/ |
| Overview | https://www.djangoproject.com/start/overview/ |
| Download | https://www.djangoproject.com/download/ |
| Documentation | https://docs.djangoproject.com/ |
| News | https://www.djangoproject.com/weblog/ |
| Code | https://github.com/django/django |
| Issues | https://code.djangoproject.com/ |
| Community | https://www.djangoproject.com/community/ |
| Foundation | https://www.djangoproject.com/foundation/ |
| ♥ Donate | https://www.djangoproject.com/fundraising/ |
| Documentation | https://docs.djangoproject.com/en/dev/ |
|
Getting Help
| https://docs.djangoproject.com/en/dev/faq/help/ |
| 6.1 | https://docs.djangoproject.com/en/6.1/internals/contributing/writing-code/unit-tests/ |
| 6.0 | https://docs.djangoproject.com/en/6.0/internals/contributing/writing-code/unit-tests/ |
| 5.2 | https://docs.djangoproject.com/en/5.2/internals/contributing/writing-code/unit-tests/ |
| 5.1 | https://docs.djangoproject.com/en/5.1/internals/contributing/writing-code/unit-tests/ |
| 5.0 | https://docs.djangoproject.com/en/5.0/internals/contributing/writing-code/unit-tests/ |
| 4.2 | https://docs.djangoproject.com/en/4.2/internals/contributing/writing-code/unit-tests/ |
| 4.1 | https://docs.djangoproject.com/en/4.1/internals/contributing/writing-code/unit-tests/ |
| 4.0 | https://docs.djangoproject.com/en/4.0/internals/contributing/writing-code/unit-tests/ |
| 3.2 | https://docs.djangoproject.com/en/3.2/internals/contributing/writing-code/unit-tests/ |
| 3.1 | https://docs.djangoproject.com/en/3.1/internals/contributing/writing-code/unit-tests/ |
| 3.0 | https://docs.djangoproject.com/en/3.0/internals/contributing/writing-code/unit-tests/ |
| 2.2 | https://docs.djangoproject.com/en/2.2/internals/contributing/writing-code/unit-tests/ |
| 2.1 | https://docs.djangoproject.com/en/2.1/internals/contributing/writing-code/unit-tests/ |
| 2.0 | https://docs.djangoproject.com/en/2.0/internals/contributing/writing-code/unit-tests/ |
| 1.11 | https://docs.djangoproject.com/en/1.11/internals/contributing/writing-code/unit-tests/ |
| 1.10 | https://docs.djangoproject.com/en/1.10/internals/contributing/writing-code/unit-tests/ |
| 1.9 | https://docs.djangoproject.com/en/1.9/internals/contributing/writing-code/unit-tests/ |
| 1.8 | https://docs.djangoproject.com/en/1.8/internals/contributing/writing-code/unit-tests/ |
| https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#top |
| ¶ | https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#unit-tests |
| Writing and running tests | https://docs.djangoproject.com/en/dev/topics/testing/overview/ |
| ¶ | https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#running-the-unit-tests |
| ¶ | https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#quickstart |
| fork Django on GitHub | https://github.com/django/django/fork |
| contributing tutorial | https://docs.djangoproject.com/en/dev/intro/contributing/ |
| Running all the tests | https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#running-unit-tests-dependencies |
| Using another settings module | https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#running-unit-tests-settings |
| Troubleshooting | https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#troubleshooting-unit-tests |
| ¶ | https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#running-tests-using-tox |
| Tox | https://tox.wiki/ |
| import sorting | https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/coding-style/#coding-style-imports |
| documentation spelling checker | https://docs.djangoproject.com/en/dev/internals/contributing/writing-documentation/#documentation-spelling-check |
| code formatting | https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/coding-style/#coding-style-python |
| ¶ | https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#testing-other-python-versions-and-database-backends |
| create and provide your own test settings | https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#running-unit-tests-settings |
| DJANGO_SETTINGS_MODULE | https://docs.djangoproject.com/en/dev/topics/settings/#envvar-DJANGO_SETTINGS_MODULE |
| ¶ | https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#running-the-javascript-tests |
| JavaScript unit tests | https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/javascript/#javascript-tests |
| ¶ | https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#running-tests-using-django-docker-box |
| django-docker-box | https://github.com/django/django-docker-box/ |
| django-docker-box | https://github.com/django/django-docker-box/ |
| ¶ | https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#using-another-settings-module |
| PYTHONPATH | https://docs.python.org/3/using/cmdline.html#envvar-PYTHONPATH |
| DATABASES | https://docs.djangoproject.com/en/dev/ref/settings/#std-setting-DATABASES |
| USER | https://docs.djangoproject.com/en/dev/ref/settings/#std-setting-USER |
| PASSWORD | https://docs.djangoproject.com/en/dev/ref/settings/#std-setting-PASSWORD |
| USER | https://docs.djangoproject.com/en/dev/ref/settings/#std-setting-USER |
| NAME | https://docs.djangoproject.com/en/dev/ref/settings/#std-setting-NAME |
| DATABASES | https://docs.djangoproject.com/en/dev/ref/settings/#std-setting-DATABASES |
| CHARSET | https://docs.djangoproject.com/en/dev/ref/settings/#std-setting-TEST_CHARSET |
| ¶ | https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#running-only-some-of-the-tests |
| ¶ | https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#running-the-selenium-tests |
| selenium | https://pypi.org/project/selenium/ |
| selenium.webdriver | https://github.com/SeleniumHQ/selenium/tree/trunk/py/selenium/webdriver |
| ¶ | https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#screenshot-tests |
| ¶ | https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#running-all-the-tests |
| aiosmtpd | https://pypi.org/project/aiosmtpd/ |
| argon2-cffi | https://pypi.org/project/argon2-cffi/ |
| asgiref | https://pypi.org/project/asgiref/ |
| bcrypt | https://pypi.org/project/bcrypt/ |
| colorama | https://pypi.org/project/colorama/ |
| docutils | https://pypi.org/project/docutils/ |
| geoip2 | https://pypi.org/project/geoip2/ |
| Jinja2 | https://pypi.org/project/Jinja2/ |
| numpy | https://pypi.org/project/numpy/ |
| Pillow | https://pypi.org/project/Pillow/ |
| PyYAML | https://pypi.org/project/PyYAML/ |
| pywatchman | https://pypi.org/project/pywatchman/ |
| redis | https://pypi.org/project/redis/ |
| pymemcache | https://pypi.org/project/pymemcache/ |
| supported Python binding | https://memcached.org/ |
| gettext | https://www.gnu.org/software/gettext/manual/gettext.html |
| gettext on Windows | https://docs.djangoproject.com/en/dev/topics/i18n/translation/#gettext-on-windows |
| selenium | https://pypi.org/project/selenium/ |
| sqlparse | https://pypi.org/project/sqlparse/ |
| tblib | https://pypi.org/project/tblib/ |
| pip requirements files | https://pip.pypa.io/en/latest/user_guide/#requirements-files |
| CACHES | https://docs.djangoproject.com/en/dev/ref/settings/#std-setting-CACHES |
| set up a spatial database
and install the Geospatial libraries | https://docs.djangoproject.com/en/dev/ref/contrib/gis/install/ |
| Watchman | https://facebook.github.io/watchman/ |
| ¶ | https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#code-coverage |
| testing code coverage | https://docs.djangoproject.com/en/dev/topics/testing/advanced/#topics-testing-code-coverage |
| ¶ | https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#code-coverage-on-pull-requests |
| diff-cover | https://github.com/Bachmann1234/diff_cover |
| ¶ | https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#contrib-apps |
| tests/ | https://github.com/django/django/blob/main/tests/ |
| tests/auth_tests | https://github.com/django/django/blob/main/tests/auth_tests |
| ¶ | https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#troubleshooting |
| ¶ | https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#test-suite-hangs-or-shows-failures-on-main-branch |
| supported Python version | https://docs.djangoproject.com/en/dev/faq/install/#faq-python-version-support |
| ¶ | https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#many-test-failures-with-unicodeencodeerror |
| ¶ | https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#tests-that-only-fail-in-combination |
| specifying further test labels | https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#runtests-specifying-labels |
| ¶ | https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#seeing-the-sql-queries-run-during-a-test |
| SQL logging | https://docs.djangoproject.com/en/dev/ref/logging/#django-db-logger |
| ¶ | https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#seeing-the-full-traceback-of-a-test-failure |
| DJANGO_TEST_PROCESSES | https://docs.djangoproject.com/en/dev/ref/django-admin/#envvar-DJANGO_TEST_PROCESSES |
| ¶ | https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#tips-for-writing-tests |
| ¶ | https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#isolating-model-registration |
| apps | https://docs.djangoproject.com/en/dev/ref/applications/#django.apps.apps |
| isolate_apps() | https://docs.djangoproject.com/en/dev/topics/testing/tools/#django.test.utils.isolate_apps |
| app_label | https://docs.djangoproject.com/en/dev/ref/models/options/#django.db.models.Options.app_label |
| isolate_apps() | https://docs.djangoproject.com/en/dev/topics/testing/tools/#django.test.utils.isolate_apps |
| ¶ | https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#id4 |
| Submitting contributions | https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/submitting-patches/ |
| Working with Git and GitHub | https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/working-with-git/ |
| Back to Top | https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#top |
|
Agence Debord donated to the Django Software Foundation to support Django development. Donate today!
| https://www.djangoproject.com/fundraising/ |
| Unit tests | https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/ |
| Running the unit tests | https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#running-the-unit-tests |
| Quickstart | https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#quickstart |
| Running tests using tox | https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#running-tests-using-tox |
| Testing other Python versions and database backends | https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#testing-other-python-versions-and-database-backends |
| Running the JavaScript tests | https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#running-the-javascript-tests |
| Running tests using django-docker-box | https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#running-tests-using-django-docker-box |
| Using another settings module | https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#using-another-settings-module |
| Running only some of the tests | https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#running-only-some-of-the-tests |
| Running the Selenium tests | https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#running-the-selenium-tests |
| Screenshot tests | https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#screenshot-tests |
| Running all the tests | https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#running-all-the-tests |
| Code coverage | https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#code-coverage |
| Code coverage on pull requests | https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#code-coverage-on-pull-requests |
| Contrib apps | https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#contrib-apps |
| Troubleshooting | https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#troubleshooting |
| Test suite hangs or shows failures on main branch | https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#test-suite-hangs-or-shows-failures-on-main-branch |
| Many test failures with UnicodeEncodeError | https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#many-test-failures-with-unicodeencodeerror |
| Tests that only fail in combination | https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#tests-that-only-fail-in-combination |
| Seeing the SQL queries run during a test | https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#seeing-the-sql-queries-run-during-a-test |
| Seeing the full traceback of a test failure | https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#seeing-the-full-traceback-of-a-test-failure |
| Tips for writing tests | https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#tips-for-writing-tests |
| Isolating model registration | https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#isolating-model-registration |
| Submitting contributions | https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/submitting-patches/ |
| Working with Git and GitHub | https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/working-with-git/ |
| Table of contents | https://docs.djangoproject.com/en/dev/contents/ |
| General Index | https://docs.djangoproject.com/en/dev/genindex/ |
| Python Module Index | https://docs.djangoproject.com/en/dev/py-modindex/ |
| Django dev documentation | https://docs.djangoproject.com/en/dev/ |
| Django internals | https://docs.djangoproject.com/en/dev/internals/ |
| Contributing to Django | https://docs.djangoproject.com/en/dev/internals/contributing/ |
| Contributing code | https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/ |
| FAQ | https://docs.djangoproject.com/en/dev/faq/ |
| Index | https://docs.djangoproject.com/en/stable/genindex/ |
| Module Index | https://docs.djangoproject.com/en/stable/py-modindex/ |
| Table of Contents | https://docs.djangoproject.com/en/stable/contents/ |
| Django Discord Server | https://chat.djangoproject.com |
| Official Django Forum | https://forum.djangoproject.com/ |
| Ticket tracker | https://code.djangoproject.com/ |
| HTML | https://media.djangoproject.com/docs/django-docs-dev-en.zip |
| PDF | https://media.readthedocs.org/pdf/django/latest/django.pdf |
| ePub | https://media.readthedocs.org/epub/django/latest/django.epub |
| Read the Docs | https://readthedocs.org/ |
|
| https://sentry.io/for/django/ |
|
Monitor your Django Code
Resolve performance bottlenecks and errors using monitoring, replays, logs and Seer an AI agent for debugging.
| https://sentry.io/for/django/ |
|
| https://jb.gg/ybja10 |
|
JetBrains delivers intelligent software solutions that make developers more productive by simplifying their challenging tasks, automating the routine, and helping them adopt the best development practices. PyCharm is the Python IDE for Professional Developers by JetBrains providing a complete set of tools for productive Python, Web and scientific development.
| https://jb.gg/ybja10 |
|
| https://kraken.tech |
|
Kraken is the most-loved operating system for energy. Powered by our Utility-Grade AI™ and deep industry know-how, we help utilities transform their technology and operations so they can lead the energy transition. Delivering better outcomes from generation through distribution to supply, Kraken powers 70+ million accounts worldwide, and is on a mission to make a big, green dent in the universe.
| https://kraken.tech |
|
| https://posthog.com |
|
PostHog is an all-in-one developer platform for building successful products. We provide product analytics, web analytics, session replay, error tracking, feature flags, experiments, surveys, LLM observability, data warehouse, CDP, workflows, logs, and an AI product assistant to help debug your code, ship features faster, and keep all your usage and customer data in one stack.
| https://posthog.com |
| About Django | https://www.djangoproject.com/start/overview/ |
| Getting Started with Django | https://www.djangoproject.com/start/ |
| Team Organization | https://www.djangoproject.com/foundation/teams/ |
| Django Software Foundation | https://www.djangoproject.com/foundation/ |
| Code of Conduct | https://www.djangoproject.com/conduct/ |
| Diversity Statement | https://www.djangoproject.com/diversity/ |
| Join a Group | https://www.djangoproject.com/community/ |
| Contribute
to Django | https://docs.djangoproject.com/en/dev/internals/contributing/ |
| Submit
a Bug | https://docs.djangoproject.com/en/dev/internals/contributing/bugs-and-features/ |
| Report
a Security Issue | https://docs.djangoproject.com/en/dev/internals/security/#reporting-security-issues |
| Individual membership | https://www.djangoproject.com/foundation/individual-members/ |
| Getting Help FAQ | https://docs.djangoproject.com/en/stable/faq/ |
| Django Discord | https://chat.djangoproject.com |
| Official Django Forum | https://forum.djangoproject.com/ |
| GitHub | https://github.com/django |
| X | https://x.com/djangoproject |
| Fediverse (Mastodon) | https://fosstodon.org/@django |
| Bluesky | https://bsky.app/profile/djangoproject.com |
| LinkedIn | https://www.linkedin.com/company/django-software-foundation |
| News RSS | https://www.djangoproject.com/rss/weblog/ |
| Sponsor Django | https://www.djangoproject.com/fundraising/ |
| Corporate membership | https://www.djangoproject.com/foundation/corporate-members/ |
| Official merchandise store | https://django.threadless.com/ |
| Benevity Workplace Giving Program | https://www.djangoproject.com/fundraising/#benevity-giving |
| Django | https://www.djangoproject.com/ |
| In-kind
donors | https://www.djangoproject.com/fundraising/#in-kind-donors |
| Threespot | https://www.threespot.com |
| andrevv | http://andrevv.com/ |
| Django Software
Foundation | https://www.djangoproject.com/foundation/ |
| registered
trademark | https://www.djangoproject.com/trademarks/ |