Testfixtures

Latest version: v8.2.0

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

Scan your dependencies

Page 10 of 23

6.0.1

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

- Fix a bug when comparing equal :class:`set` instances using :func:`compare`
when ``strict==True``.

6.0.0

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

- :func:`compare` will now handle objects that do not natively support equality or inequality
and will treat these objects as equal if they are of the same type and have the same attributes
as found using :func:`vars` or ``__slots__``. This is a change in behaviour which, while it could
conceivably cause tests that are currently failing to pass, should not cause any currently
passing tests to start failing.

- Add support for writing to the ``stdin`` of :class:`~testfixtures.popen.MockPopen` instances.

- The default behaviour of :class:`~testfixtures.popen.MockPopen` can now be controlled by
providing a callable.

- :meth:`LogCapture.actual` is now part of the documented public interface.

- Add :meth:`LogCapture.check_present` to help with assertions about a sub-set of messages logged
along with those that are logged in a non-deterministic order.

- :class:`Comparison` now supports objects with ``__slots__``.

- Added :class:`ShouldAssert` as a simpler tool for testing test helpers.

- Changed the internals of the various decorators testfixtures provides such that they can
be used in conjunction with :func:`unittest.mock.patch` on the same test method or function.

- Changed the internals of :class:`ShouldRaise` and :class:`Comparison` to make use of
:func:`compare` and so provide nested comparisons with better feedback. This finally
allows :class:`ShouldRaise` to deal with Django's
:class:`~django.core.exceptions.ValidationError`.

- Added handling of self-referential structures to :func:`compare` by treating all but the first
occurence as equal. Another change needed to support Django's insane
:class:`~django.core.exceptions.ValidationError`.

Thanks to Hamish Downer and Tim Davies for their work on :class:`~testfixtures.popen.MockPopen`.

Thanks to Wim Glenn and Daniel Fortunov for their help reviewing some of the more major changes.

5.4.0

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

- Add explicit support for :class:`~unittest.mock.Mock` to :func:`compare`.

5.3.1

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

- Fix missing support for the `start_new_session` parameter to
:class:`~testfixtures.popen.MockPopen`.

5.3.0

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

- Add pytest traceback hiding for :meth:`TempDirectory.compare`.

- Add warnings that :func:`log_capture`, :func:`tempdir` and
:func:`replace` are not currently compatible with pytest's fixtures
mechanism.

- Better support for ``stdout`` or ``stderr`` *not* being set to ``PIPE``
when using :class:`~testfixtures.popen.MockPopen`.

- Add support to :class:`~testfixtures.popen.MockPopen` for
using :class:`subprocess.Popen` as a context manager in Python 3.

- Add support to :class:`~testfixtures.popen.MockPopen` for ``stderr=STDOUT``.

Thanks to Tim Davies for his work on :class:`~testfixtures.popen.MockPopen`.

5.2.0

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

- :any:`test_datetime <mock_datetime>` and :class:`test_time <mock_time>` now accept a
:class:`~datetime.datetime` instance during instantiation to set the initial
value.

- :class:`test_date <mock_date>` now accepts a :class:`~datetime.date` instance during
instantiation to set the initial value.

- Relax the restriction on adding, setting or instantiating :any:`test_datetime <mock_datetime>`
with `tzinfo` such that if the `tzinfo` matches the one configured,
then it's okay to add.
This means that you can now instantiate a :any:`test_datetime <mock_datetime>` with an existing
:class:`~datetime.datetime` instance that has `tzinfo` set.

- :func:`testfixtures.django.compare_model` now ignores
:class:`many to many <django.db.models.ManyToManyField>` fields rather than
blowing up on them.

- Drop official support for Python 3.4, although things should continue to
work.

Page 10 of 23

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.