Pytest-django

Latest version: v4.9.0

Safety actively analyzes 681881 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 6 of 10

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.

3.1.2

------

Bug fixes
^^^^^^^^^

* Auto clearing of ``mail.outbox`` has been re-introduced to not break
functionality in 3.x.x release. This means that Compatibility issues
mentioned in the 3.1.0 release are no longer present. Related issue:
`pytest-django issue <https://github.com/pytest-dev/pytest-django/issues/433>`__

3.1.1

------

Bug fixes
^^^^^^^^^

* Workaround `--pdb` interaction with Django TestCase. The issue is caused by
Django TestCase not implementing TestCase.debug() properly but was brought to
attention with recent changes in pytest 3.0.2. Related issues:
`pytest issue <https://github.com/pytest-dev/pytest/issues/1977>`__,
`Django issue <https://code.djangoproject.com/ticket/27391>`__

3.1.0

------

Features
^^^^^^^^
* Added new function scoped fixture ``mailoutbox`` that gives access to
djangos ``mail.outbox``. The will clean/empty the ``mail.outbox`` to
assure that no old mails are still in the outbox.
* If ``django.contrib.sites`` is in your INSTALLED_APPS, Site cache will
be cleared for each test to avoid hitting the cache and cause wrong Site
object to be returned by ``Site.objects.get_current()``.

Compatibility
^^^^^^^^^^^^^
* IMPORTANT: the internal autouse fixture _django_clear_outbox has been
removed. If you have relied on this to get an empty outbox for your
test, you should change tests to use the ``mailoutbox`` fixture instead.
See documentation of ``mailoutbox`` fixture for usage. If you try to
access mail.outbox directly, AssertionError will be raised. If you
previously relied on the old behaviour and do not want to change your
tests, put this in your project conftest.py::

pytest.fixture(autouse=True)
def clear_outbox():
from django.core import mail
mail.outbox = []

3.0.0

------

Bug fixes
^^^^^^^^^

* Fix error when Django happens to be imported before pytest-django runs.
Thanks to Will Harris for `the bug report
<https://github.com/pytest-dev/pytest-django/issues/289>`__.

Features
^^^^^^^^
* Added a new option ``--migrations`` to negate a default usage of
``--nomigrations``.

* The previously internal pytest-django fixture that handles database creation
and setup has been refactored, refined and made a public API.

This opens up more flexibility and advanced use cases to configure the test
database in new ways.

See :ref:`advanced-database-configuration` for more information on the new
fixtures and example use cases.

Compatibility
^^^^^^^^^^^^^
* Official for the pytest 3.0.0 (2.9.2 release should work too, though). The
documentation is updated to mention ``pytest`` instead of ``py.test``.

* Django versions 1.4, 1.5 and 1.6 is no longer supported. The supported
versions are now 1.7 and forward. Django master is supported as of
2016-08-21.

* pytest-django no longer supports Python 2.6.

* Specifying the ``DJANGO_TEST_LIVE_SERVER_ADDRESS`` environment variable is no
longer supported. Use ``DJANGO_LIVE_TEST_SERVER_ADDRESS`` instead.

* Ensuring accidental database access is now stricter than before. Previously
database access was prevented on the cursor level. To be safer and prevent
more cases, it is now prevented at the connection level. If you previously
had tests which interacted with the databases without a database cursor, you
will need to mark them with the ``pytest.mark.django_db`` marker or
request the ``db`` fixture.

* The previously undocumented internal fixtures ``_django_db_setup``,
``_django_cursor_wrapper`` have been removed in favour of the new public
fixtures. If you previously relied on these internal fixtures, you must
update your code. See :ref:`advanced-database-configuration` for more
information on the new fixtures and example use cases.

Page 6 of 10

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.