Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update pytest-django to 4.9.0 #1433

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

pyup-bot
Copy link
Collaborator

@pyup-bot pyup-bot commented Sep 2, 2024

This PR updates pytest-django from 3.1.2 to 4.9.0.

Changelog

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``.

4.5.2

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

Bugfixes
^^^^^^^^

* Fix regression in v4.5.0 - ``pytest.mark.django_db(reset_sequence=True)`` now
implies ``transaction=True`` again.

4.5.1

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

Bugfixes
^^^^^^^^

* Fix regression in v4.5.0 - database tests inside (non-unittest) classes were
not ordered correctly to run before non-database tests, same for transactional
tests before non-transactional tests.

4.5.0

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

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

* Add support for :ref:`rollback emulation/serialized rollback
<test-case-serialized-rollback>`. The :func:`pytest.mark.django_db` marker
has a new ``serialized_rollback`` option, and a
:fixture:`django_db_serialized_rollback` fixture is added.

* Official Python 3.10 support.

* Official Django 4.0 support (tested against 4.0rc1 at the time of release).

* Drop official Django 3.0 support. Django 2.2 is still supported, and 3.0
will likely keep working until 2.2 is dropped, but it's not tested.

* Added pyproject.toml file.

* Skip Django's `setUpTestData` mechanism in pytest-django tests. It is not
used for those, and interferes with some planned features. Note that this
does not affect ``setUpTestData`` in unittest tests (test classes which
inherit from Django's `TestCase`).

Bugfixes
^^^^^^^^

* Fix :fixture:`live_server` when using an in-memory SQLite database.

* Fix typing of ``assertTemplateUsed`` and ``assertTemplateNotUsed``.

4.4.0

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

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

* Add a fixture :fixture:`django_capture_on_commit_callbacks` to capture
:func:`transaction.on_commit() <django.db.transaction.on_commit>` callbacks
in tests.

4.3.0

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

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

* Add experimental :ref:`multiple databases <multi-db>` (multi db) support.

* Add type annotations. If you previously excluded ``pytest_django`` from
your type-checker, you can remove the exclusion.

* Documentation improvements.

4.2.0

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

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

* Official Django 3.2 support.

* Documentation improvements.

Bugfixes
^^^^^^^^

* Disable atomic durability check on non-transactional tests (910).

4.1.0

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

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

* Add the :fixture:`async_client` and :fixture:`async_rf` fixtures (864).

* Add :ref:`django_debug_mode <usage>` to configure how ``DEBUG`` is set in tests (228).

* Documentation improvements.

Bugfixes
^^^^^^^^

* Make :fixture:`admin_user` work for custom user models without an ``email`` field.

4.0.0

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

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

This release contains no breaking changes, except dropping compatibility
with some older/unsupported versions.

* Drop support for Python versions before 3.5 (868).

Previously 2.7 and 3.4 were supported. Running ``pip install pytest-django``
on Python 2.7 or 3.4 would continue to install the compatible 3.x series.

* Drop support for Django versions before 2.2 (868).

Previously Django>=1.8 was supported.

* Drop support for pytest versions before 5.4 (868).

Previously pytest>=3.6 was supported.

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

* Officially support Python 3.9.

* Add ``pytest_django.__version__`` (880).

* Minor documentation improvements (882).

Bugfixes
^^^^^^^^

* Make the ``admin_user`` and ``admin_client`` fixtures compatible with custom
user models which don't have a ``username`` field (457).

* Change the ``admin_user`` fixture to use ``get_by_natural_key()`` to get the
user instead of directly using ``USERNAME_FIELD``, in case it is overridden,
and to match Django (879).

Misc
^^^^

* Fix pytest-django's own tests failing due to some deprecation warnings
(875).

3.10.0

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

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

* Officially support Django 3.1

* Preliminary support for upcoming Django 3.2

* Support for pytest-xdist 2.0


Misc
^^^^

* Fix running pytest-django's own tests against pytest 6.0 (855)

3.9.0

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

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

* Improve test ordering with Django test classes (830)

* Remove import of pkg_resources for parsing pytest version (performance) (826)

Bugfixes
^^^^^^^^

* Work around unittest issue with pytest 5.4.{0,1} (825)

* Don't break --failed-first when re-ordering tests (819, 820)

* pytest_addoption: use `group.addoption` (833)

Misc
^^^^

* Remove Django version from --nomigrations heading (822)

* docs: changelog: prefix headers with v for permalink anchors

* changelog: add custom/fixed anchor for last version

* setup.py: add Changelog to project_urls

3.8.0

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

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

* Make Django's assertion helpers available in pytest_django.asserts (709).

* Report django-configurations setting (791)

3.7.0

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

Bugfixes
^^^^^^^^

* Monkeypatch pytest to not use ``TestCase.debug`` with unittests, instead
of patching it into Django (782).

* Work around pytest crashing due to ``pytest.fail`` being used from within the
DB blocker, and pytest trying to display an object representation involving
DB access (781).  pytest-django uses a ``RuntimeError`` now instead.

3.6.0

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

Features
^^^^^^^^

* Rename test databases when running parallel Tox (678, 680)

Bugfixes
^^^^^^^^

* Django unittests: restore "debug" function (769, 771)

Misc
^^^^

* Improve/harden internal tests / infrastructure.

3.5.1

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

Bugfixes
^^^^^^^^

* Fix compatibility with pytest 5.x (751)

3.5.0

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

Features
^^^^^^^^

* 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)

3.4.8

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

Bugfixes
^^^^^^^^

* Fix DB renaming fixture for Multi-DB environment with SQLite (679)

3.4.7

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

Bugfixes
^^^^^^^^

* Fix disabling/handling of unittest methods with pytest 4.2+ (700)

3.4.6

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

Bugfixes
^^^^^^^^

* django_find_project: add cwd as fallback always (690)

Misc
^^^^

* Enable tests for Django 2.2 and add classifier (693)
* Disallow pytest 4.2.0 in ``install_requires`` (697)

3.4.5

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

Bugfixes
^^^^^^^^

* Use ``request.config`` instead of ``pytest.config`` (677)
* :fixture:`admin_user`: handle "email" username_field (676)

Misc
^^^^

* Minor doc fixes (674)
* tests: fix for pytest 4 (675)

3.4.4

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

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 (666).

Misc
^^^^

* MANIFEST.in: include tests for downstream distros (653).
* Ensure that the LICENSE file is included in wheels (665).
* Run black on source.

3.4.3

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

Bugfixes
^^^^^^^^

* Fix OSError with arguments containing ``::`` on Windows (641).

3.4.2

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

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).

3.4.0

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

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 dependency, use pathlib instead (631).

3.3.3

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

Bug fixes
^^^^^^^^^

* Fixed registration of :func:`~pytest.mark.ignore_template_errors` marker,
which is required with ``pytest --strict`` (609).
* Fixed another regression with unittest (624, 625).

Docs
^^^^

* Use sphinx_rtf_theme (621).
* Minor fixes.

3.3.2

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

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).

3.3.0

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

Features
^^^^^^^^

* Added new fixtures ``django_mail_dnsname`` and ``django_mail_patch_dns``,
used by ``mailoutbox`` to monkeypatch the ``DNS_NAME`` used in
: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 visible to following tests (612).

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

* The required `pytest` version changed from >=2.9 to >=3.6.

3.2.1

------

* Fixed automatic deployment to PyPI.

3.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 not go unnoticed 🌟

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

* Support for Django 2.0 has been added.
* Support for Django before 1.8 has been dropped.
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.

1 participant