Skip to content

Conversation

@pyup-bot
Copy link
Collaborator

@pyup-bot pyup-bot commented Apr 3, 2025

This PR updates pytest-django from 4.5.2 to 4.11.1.

Changelog

4.11.1

--------------------

Bugfixes
^^^^^^^^

* Fixed a regression in v4.11.0 for Django ``TestCase`` tests using the ``databases`` class variable (`1188 <https://github.com/pytest-dev/pytest-django/issues/1188>`__).

4.11.0

--------------------

Compatibility
^^^^^^^^^^^^^

* Added official support for Django 5.2 (`PR 1179 <https://github.com/pytest-dev/pytest-django/pull/1179>`__).
* Dropped testing on MySQL’s MyISAM storage engine (`PR 1180 <https://github.com/pytest-dev/pytest-django/pull/1180>`__).

Bugfixes
^^^^^^^^

* Stopped setting up and serializing databases on test session setup when not needed (the database is not requested / ``serialized_rollback`` is not used).
On test databases with large amounts of pre-seeded data, this may remove a delay of a few seconds when running ``pytest --reuse-db``.

The determination of which databases to setup is done by static inspection of the test suite.
Using pytest's dynamic features to request db access, such as :meth:`request.getfixturevalue("db") <pytest.FixtureRequest.getfixturevalue>`, may throw off this analysis.
If you start seeing ``DatabaseOperationForbidden`` or "unable to open database" errors, this is likely the cause.
To fix this, decorate at least one test with the :func:`django_db <pytest.mark.django_db>` marker with appropriate ``databases`` and ``serialized_rollback`` settings.

4.10.0

--------------------

Compatibility
^^^^^^^^^^^^^

* Added official support for Python 3.13.

Improvements
^^^^^^^^^^^^

* Added ``using`` argument to :fixture:`django_assert_num_queries` and
:fixture:`django_assert_max_num_queries` to easily specify the database
alias to use.

Bugfixes
^^^^^^^^

* Fixed lock/unlock of db breaks if pytest is executed twice in the same process.

4.9.0

-------------------

Compatibility
^^^^^^^^^^^^^

* Added official support for Django 5.1.
* Dropped support for Django 3.2 and 4.1.

Improvements
^^^^^^^^^^^^

* Respect the ``string_if_invalid`` template setting when
``--fail-on-template-vars`` is active and
:func:`pytest.mark.ignore_template_errors <pytest.mark.ignore_template_errors>`
is used.

* Avoid running database migrations for :class:`~django.test.SimpleTestCase`
unittest tests.

* Added docstrings to public fixtures.

Bugfixes
^^^^^^^^

* Fix type hints for ``pytest_django.asserts.assertFormError()`` and
``pytest_django.asserts.assertForSetError()``.

4.8.0

-------------------

Improvements
^^^^^^^^^^^^

* Added ``pytest_django.asserts.assertMessages()`` to mimic the behaviour of the
:meth:`~django.contrib.messages.test.MessagesTestMixin.assertMessages` method
for Django versions >= 5.0.

Bugfixes
^^^^^^^^

* Fix `--help`/`--version` crash in a partially configured app.

4.7.0

-------------------

Compatibility
^^^^^^^^^^^^^

* Official Django 5.0 support.

* Official Python 3.12 support.

Improvements
^^^^^^^^^^^^

* The Django test tags from the previous release now works on any
:class:`~django.test.SimpleTestCase` (i.e. any Django test framework test
class), not just :class:`~django.test.TransactionTestCase` classes.

* Some improvements for those of us who like to type their tests:

- Add ``pytest_django.DjangoAssertNumQueries`` for typing
 :fixture:`django_assert_num_queries` and
 :fixture:`django_assert_max_num_queries`.

- Add ``pytest_django.DjangoCaptureOnCommitCallbacks`` for typing
 :fixture:`django_capture_on_commit_callbacks`.

- Add ``pytest_django.DjangoDbBlocker`` for typing
 :fixture:`django_db_blocker`.

4.6.0

-------------------

Compatibility
^^^^^^^^^^^^^

* Official Django 4.1 & 4.2 support.

* Official Python 3.11 support.

* Drop support for Python version 3.5, 3.6 & 3.7.

* Drop official support for Django 4.0 and 2.2

* Drop support for pytest < 7.

Improvements
^^^^^^^^^^^^

* Add support for setting :py:attr:`available_apps
<django.test.TransactionTestCase.available_apps>` in the :func:`django_db
<pytest.mark.django_db>` marker.

* Convert Django :ref:`test tags <django:topics-tagging-tests>` to :ref:`Pytest
markers <pytest:mark examples>`.

* Show Django's version in the pytest ``django`` report header.

* Add precise ``pytest_django.asserts.assertQuerySetEqual`` typing.

Bugfixes
^^^^^^^^

* Fix bug where the effect of :func:`pytest.mark.ignore_template_errors
<pytest.mark.ignore_template_errors>` was not reset when using
``--fail-on-template-vars``.
Links

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants