Case

Latest version: v1.5.3

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

Scan your dependencies

Page 1 of 4

1.5.3

=====
:release-date: 2017-02-22 03:26 p.m PST
:release-by: Ask Solem

- ``patch.multiple`` now works.

1.5.2

=====
:release-date: 2016-10-28 03:40 p.m. PDT
:release-by: Ask Solem

- Using setup/teardown instead of setup_method/teardown_method was a bad idea.

Since it's way more common to override setup/teardown, and it's
likely people forget to call super in these methods, the change
crashed several test suites.

So on pytest the decorators are now back to augmenting
setup_method/teardown_method again.

1.5.1

=====
:release-date: 2016-10-28 03:40 p.m. PDT
:release-by: Ask Solem

- 1.5.0 had a left over print statement :blush:

.. _version-1.5.0:

1.5.0

=====
:release-date: 2016-10-28 03:36 p.m. PDT
:release-by: Ask Solem

- Pytest: When decorating classes using the ``skip.*`` and ``mock.*``
decorators, these now augment ``cls.setup``/``cls.teardown`` instead of
``cls.setup_method``/``cls.teardown_method``.

It's a bit hard to find in the pytest documentation, but pytest
will always call test_cls.setup and test_cls.teardown.

- Pytest: Adds ``patching.object``.

This works exactly like :func:`unittest.mock.patch.object`,
you give it an object and an attribute name, and it will patch
that attribute on the object. It also supports the same arguments
and extra options.

Example:

.. code-block:: python

pytest.fixture
def channel(patching):
c = Channel()
patching(c, 'connect')
return c

.. _version-1.4.0:

1.4.0

=====
:release-date: 2016-10-17 06:14 p.m. PDT
:release-by: Ask Solem

- Adds new helper: ``case.pytest.fixture_with_options``.

Example:

.. code-block:: python

fixture_with_options()
def sftp(request,
username='test_username',
password='test_password'):
return {'username': username, 'password': password}

sftp.options(username='foo', password='bar')
def test_foo(sftp):
assert sftp['username'] == 'foo'
assert sftp['password'] == 'bar'

.. _version-1.3.1:

1.3.1

=====
:release-date: 2016-07-22 06:14 p.m. PDT
:release-by: Ask Solem

- All case decorators now works with py.test classes.

- Py.test: Adds new `stdouts` fixture that patches :data:`sys.stdout`,
and :data:`sys.stderr`.

Example:

.. code-block:: python

def test_x(stdouts):
print('foo')
assert 'foo' in stdouts.stdout.getvalue()
print('bar', file=sys.stderr)
assert 'bar' in stdouts.stderr.getvalue()

- Py.test: The `patching` fixture can now mock modules.

Example:

.. code-block:: python

def test_x(patching):
gevent, gevent_monkey = patching.modules(
'gevent',
'gevent.monkey',
)
os = patching.modules('os')
gevent_monkey.patch_all.side_effect = RuntimeError()

with pytest.raises(RuntimeError):
from gevent import monkey
monkey.patch_all()

.. _version-1.3.0:

Page 1 of 4

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.