freshcrate
Home > Frameworks > pytest-django

pytest-django

A Django plugin for pytest.

Description

.. image:: https://img.shields.io/pypi/v/pytest-django.svg?style=flat :alt: PyPI Version :target: https://pypi.python.org/pypi/pytest-django .. image:: https://img.shields.io/pypi/pyversions/pytest-django.svg :alt: Supported Python versions :target: https://pypi.python.org/pypi/pytest-django .. image:: https://github.com/pytest-dev/pytest-django/workflows/main/badge.svg :alt: Build Status :target: https://github.com/pytest-dev/pytest-django/actions .. image:: https://img.shields.io/pypi/djversions/pytest-django.svg :alt: Supported Django versions :target: https://pypi.org/project/pytest-django/ .. image:: https://img.shields.io/codecov/c/github/pytest-dev/pytest-django.svg?style=flat :alt: Coverage :target: https://codecov.io/gh/pytest-dev/pytest-django Welcome to pytest-django! ========================= pytest-django allows you to test your Django project/applications with the `pytest testing tool <https://pytest.org/>`_. * `Quick start / tutorial <https://pytest-django.readthedocs.io/en/latest/tutorial.html>`_ * `Changelog <https://pytest-django.readthedocs.io/en/latest/changelog.html>`_ * Full documentation: https://pytest-django.readthedocs.io/en/latest/ * `Contribution docs <https://pytest-django.readthedocs.io/en/latest/contributing.html>`_ * Version compatibility: * Django: 4.2, 5.1, 5.2, 6.0 and latest main branch (compatible at the time of each release) * Python: CPython>=3.10 or PyPy 3 * pytest: >=7.0 For compatibility with older versions, use previous pytest-django releases. * Licence: BSD * `All contributors <https://github.com/pytest-dev/pytest-django/contributors>`_ * GitHub repository: https://github.com/pytest-dev/pytest-django * `Issue tracker <https://github.com/pytest-dev/pytest-django/issues>`_ * `Python Package Index (PyPI) <https://pypi.python.org/pypi/pytest-django/>`_ Install pytest-django --------------------- :: pip install pytest-django Why would I use this instead of Django's `manage.py test` command? ------------------------------------------------------------------ Running your test suite with pytest-django allows you to tap into the features that are already present in pytest. Here are some advantages: * `Manage test dependencies with pytest fixtures. <https://pytest.org/en/latest/how-to/fixtures.html>`_ * Less boilerplate tests: no need to import unittest, create a subclass with methods. Write tests as regular functions. * Database re-use: no need to re-create the test database for every test run. * Run tests in multiple processes for increased speed (with the pytest-xdist plugin). * Make use of other `pytest plugins <https://pytest.org/en/latest/how-to/plugins.html>`_. * Works with both worlds: Existing unittest-style TestCase's still work without any modifications. See the `pytest documentation <https://pytest.org/en/latest/>`_ for more information on pytest itself.

Release History

VersionChangesUrgencyDate
4.12.0Imported from PyPI (4.12.0)Low4/21/2026
v4.11.1https://github.com/pytest-dev/pytest-django/blob/main/docs/changelog.rst#v4111-2025-04-03Low4/3/2025
v4.11.0https://github.com/pytest-dev/pytest-django/blob/main/docs/changelog.rst#v4110-2025-04-01Low4/1/2025
v4.10.0https://github.com/pytest-dev/pytest-django/blob/main/docs/changelog.rst#v4100-2025-02-10Low2/10/2025
v4.9.0https://github.com/pytest-dev/pytest-django/blob/main/docs/changelog.rst#v490-2024-09-02Low9/2/2024
v4.8.0https://pytest-django.readthedocs.io/en/latest/changelog.html#v4-8-0-2024-01-30Low1/30/2024
v4.7.0https://pytest-django.readthedocs.io/en/latest/changelog.html#v4-7-0-2023-11-08Low11/8/2023
v4.6.0https://pytest-django.readthedocs.io/en/latest/changelog.html#v4-6-0-2023-10-30Low10/30/2023
v4.5.2https://pytest-django.readthedocs.io/en/latest/changelog.html#v4-5-2-2021-12-07Low12/7/2021
v4.5.1https://pytest-django.readthedocs.io/en/latest/changelog.html#v4-5-1-2021-12-02Low12/2/2021
v4.5.0https://pytest-django.readthedocs.io/en/latest/changelog.html#v4-5-0-2021-12-01Low12/1/2021
v4.3.0https://pytest-django.readthedocs.io/en/latest/changelog.html#v4-3-0-2021-05-15Low5/19/2021
v4.1.0https://pytest-django.readthedocs.io/en/latest/changelog.html#v4-1-0-2020-10-22Low10/22/2020
v4.0.0https://pytest-django.readthedocs.io/en/latest/changelog.html#v4-0-0-2020-10-16Low10/16/2020
v3.8.0https://pytest-django.readthedocs.io/en/latest/changelog.html#v3-8-0-2020-01-14Low2/6/2020
v3.5.1Release v3.5.1Low6/29/2019
v3.5.0Features ^^^^^^^^ * Run tests in the same order as Django (#223) * Use verbosity=0 with disabled migrations (#729, #730) Bugfixes ^^^^^^^^ * django_db_setup: warn instead of crash with teardown errors (#726) Misc ^^^^ * tests: fix test_sqlite_database_renamed (#739, #741) * tests/conftest.py: move import of db_helpers (#737) * Cleanup/improve coverage, mainly with tests (#706) * Slightly revisit unittest handling (#740) Low6/3/2019
3.4.5Release 3.4.5Low1/7/2019
3.4.43.4.4 (2018-11-13) ------------------ Bugfixes ^^^^^^^^ * Refine the django.conf module check to see if the settings really are configured (#668). * Avoid crash after OSError during Django path detection (#664). Features ^^^^^^^^ * Add parameter info to fixture assert_num_queries to display additional message on failure (#663). Docs ^^^^ * Improve doc for django_assert_num_queries/django_assert_max_num_queries. * Add warning about sqlite specific snippet + fix typos (#Low11/13/2018
3.4.3Release 3.4.3Low9/16/2018
3.4.23.4.2 (2018-08-20) ------------------ Bugfixes ^^^^^^^^ * Changed dependency for pathlib to pathlib2 (#636). * Fixed code for inserting the project to sys.path with pathlib to use an absolute path, regression in 3.4.0 (#637, #638). Low8/20/2018
3.4.1Release 3.4.1Low8/16/2018
3.4.03.4.0 (2018-08-16) ------------------ Features ^^^^^^^^ * Added new fixture :fixture:`django_assert_max_num_queries` (#547). * Added support for ``connection`` and returning the wrapped context manager with :fixture:`django_assert_num_queries` (#547). * Added support for resetting sequences via :fixture:`django_db_reset_sequences` (#619). Bugfixes ^^^^^^^^ * Made sure to not call django.setup() multiple times (#629, #531). Compatibility ^^^^^^^^^^^^^ * Removed py deLow8/16/2018
3.3.2Release 3.3.2Low6/21/2018
3.3.13.3.1 (2018-06-21) ------------------ Bug fixes ^^^^^^^^^ * Fixed test for classmethod with Django TestCases again (#618, introduced in #598 (3.3.0)). Compatibility ^^^^^^^^^^^^^ * Support Django 2.1 (no changes necessary) (#614). Low6/21/2018
3.3.0Features ^^^^^^^^ * Added new fixtures ``django_mail_dnsname`` and ``django_mail_patch_dns``, used by ``mailoutbox`` to monkeypatch the ``DNS_NAME`` used in :py:mod:`django.core.mail` to improve performance and reproducibility. Bug fixes ^^^^^^^^^ * Fixed test for classmethod with Django TestCases (#597, #598). * Fixed RemovedInPytest4Warning: MarkInfo objects are deprecated (#596, #603) * Fixed scope of overridden settings with live_server fixture: previously they were Low6/15/2018
3.2.03.2.0 ----- Features ^^^^^^^^ * Added new fixture `django_assert_num_queries` for testing the number of database queries (#387). * `--fail-on-template-vars` has been improved and should now return full/absolute path (#470). * Support for setting the live server port (#500). * unittest: help with setUpClass not being a classmethod (#544). Bug fixes ^^^^^^^^^ * Fix --reuse-db and --create-db not working together (#411). * Numerous fixes in the documentation. These should nLow4/14/2018

Dependencies & License Audit

Loading dependencies...

Similar Packages

pre-commitA framework for managing and maintaining multi-language pre-commit hooks.v4.6.0
azure-core-tracing-opentelemetryMicrosoft Azure Azure Core OpenTelemetry plugin Library for Pythonazure-template_0.1.0b6187637
spdx-toolsSPDX parser and tools.0.8.5
lacesDjango components that know how to render themselves.0.1.2
django-tasksA backport of Django's built in Tasks framework0.12.0