./devel/py-test-mock, Thin-wrapper around the mock package for easier use with py.test

[ CVSweb ] [ Homepage ] [ RSS ] [ Required by ] [ Add to tracker ]


Branch: CURRENT, Version: 3.6.1, Package name: py39-test-mock-3.6.1, Maintainer: pkgsrc-users

This plugin installs a mocker fixture which is a thin-wrapper around
the patching API provided by the mock package, but with the benefit
of not having to worry about undoing patches at the end of a test.


Required to run:
[devel/py-setuptools] [devel/py-test] [lang/python37]

Required to build:
[pkgtools/cwrappers] [devel/py-setuptools_scm]

Master sites:

Filesize: 29.231 KB

Version history: (Expand)


CVS history: (Expand)


   2021-11-25 21:10:26 by Adam Ciarcinski | Files touched by this commit (3) | Package updated
Log message:
py-test-mock: updated to 3.6.1

3.6.1 (2021-05-06)
------------------

* Fix ``mocker.resetall()`` when using ``mocker.spy()``

3.6.0 (2021-04-24)
------------------

* pytest-mock no longer supports Python 3.5.

* Correct type annotations for ``mocker.patch.object`` to also include the \ 
string form.

* ``reset_all`` now supports ``return_value`` and ``side_effect`` keyword arguments.

3.5.1 (2021-01-10)
------------------

* Use ``inspect.getattr_static`` instead of resorting to ``object.__getattribute__``
  magic. This should better comply with objects which implement a custom descriptor
  protocol.

3.5.0 (2021-01-04)
------------------

* Now all patch functions will emit a warning instead of raising a \ 
``ValueError`` when used
  as a context-manager.

* Additionally, ``mocker.patch.context_manager`` is available when the user \ 
intends to mock
  a context manager (for example  ``threading.Lock`` object), which will not \ 
emit that
  warning.

3.4.0 (2020-12-15)
------------------

* Add `mock.seal` alias to the `mocker` fixture.

* Fixed spying on exceptions not covered by the ``Exception``
  superclass, like ``KeyboardInterrupt``.

  Before the fix, both ``spy_return`` and ``spy_exception``
  were always assigned to ``None``
  whenever such an exception happened. And after this fix,
  ``spy_exception`` is set to a correct value of an exception
  that has actually happened.

3.3.1 (2020-08-24)
------------------

* Introduce ``MockFixture`` as an alias to ``MockerFixture``.

  Before ``3.3.0``, the fixture class was named ``MockFixture``, but was renamed \ 
to ``MockerFixture`` to better
  match the ``mocker`` fixture. While not officially part of the API, it was \ 
later discovered that this broke
  the code of some users which already imported ``pytest_mock.MockFixture`` for \ 
type annotations, so we
  decided to reintroduce the name as an alias.

  Note however that this is just a stop gap measure, and new code should use \ 
``MockerFixture`` for type annotations.

* Improved typing for ``MockerFixture.patch``

3.3.0 (2020-08-21)
------------------

* ``pytest-mock`` now includes inline type annotations and exposes them to user \ 
programs. The ``mocker`` fixture returns ``pytest_mock.MockerFixture``, which \ 
can be used to annotate your tests:

  .. code-block:: python

        from pytest_mock import MockerFixture

        def test_foo(mocker: MockerFixture) -> None:
            ...

  The type annotations were developed against mypy version ``0.782``, the
  minimum version supported at the moment. If you run into an error that you \ 
believe to be incorrect, please open an issue.

3.2.0 (2020-07-11)
------------------

* `AsyncMock \ 
<https://docs.python.org/3/library/unittest.mock.html#unittest.mock.AsyncMock>`__ \ 
is now exposed in ``mocker`` and supports provides assertion introspection \ 
similar to ``Mock`` objects.

3.1.1 (2020-05-31)
------------------

* Fixed performance regression caused by the ``ValueError`` raised
  when ``mocker`` is used as context manager.

3.1.0 (2020-04-18)
------------------

* New mocker fixtures added that allow using mocking functionality in other scopes:

  * ``class_mocker``
  * ``module_mocker``
  * ``package_mocker``
  * ``session_mocker``

3.0.0 (2020-03-31)
------------------

* Python 2.7 and 3.4 are no longer supported. Users using ``pip 9`` or later \ 
will install
  a compatible version automatically.

* ``mocker.spy`` now also works with ``async def`` functions.
   2021-10-26 12:20:11 by Nia Alarie | Files touched by this commit (3016)
Log message:
archivers: Replace RMD160 checksums with BLAKE2s checksums

All checksums have been double-checked against existing RMD160 and
SHA512 hashes

Could not be committed due to merge conflict:
devel/py-traitlets/distinfo

The following distfiles were unfetchable (note: some may be only fetched
conditionally):

./devel/pvs/distinfo pvs-3.2-solaris.tgz
./devel/eclipse/distinfo eclipse-sourceBuild-srcIncluded-3.0.1.zip
   2021-10-07 15:44:44 by Nia Alarie | Files touched by this commit (3017)
Log message:
devel: Remove SHA1 hashes for distfiles
   2020-05-16 18:30:16 by Adam Ciarcinski | Files touched by this commit (4)
Log message:
pytest from versioned deps.
   2020-01-27 14:05:07 by Adam Ciarcinski | Files touched by this commit (2) | Package updated
Log message:
py-test-mock: updated to 2.0.0

2.0.0:

Breaking Changes

mocker.spy attributes for tracking returned values and raised exceptions of its \ 
spied functions are now called spy_return and spy_exception, instead of reusing \ 
the existing MagicMock attributes return_value and side_effect.

Version 1.13 introduced a serious regression: after a spied function using \ 
mocker.spy raises an exception, further calls to the spy will not call the spied \ 
function, always raising the first exception instead: assigning to side_effect \ 
causes unittest.mock to behave this way.

The deprecated mock alias to the mocker fixture has finally been removed.
   2019-12-11 11:32:34 by Adam Ciarcinski | Files touched by this commit (2) | Package updated
Log message:
py-test-mock: updated to 1.13.0

1.13.0:
* The object returned by ``mocker.spy`` now also tracks any side effect
  of the spied method/function.
   2019-11-21 21:35:28 by Adam Ciarcinski | Files touched by this commit (2) | Package updated
Log message:
py-test-mock: updated to 1.12.1

1.12.1:
* Fix error if ``mocker.patch`` is used in code where the source file
  is not available, for example stale ``.pyc`` files
   2019-11-20 11:10:22 by Adam Ciarcinski | Files touched by this commit (2) | Package updated
Log message:
py-test-mock: updated to 1.12.0

1.12.0:
Now all patch functions also raise a ValueError when used as a context-manager.