Skip to content

Commit

Permalink
Adjustments for PyPI release
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoddemus committed Jul 17, 2014
1 parent 2a1be6c commit 22d194d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
20 changes: 11 additions & 9 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
===========
pytest-mock
===========

This plugin installs a fixture ``mock`` which is a thin-wrapper around the patching API
This plugin installs a ``mock`` fixture which is a thin-wrapper around the patching API
provided by the excellent `mock <http://pypi.python.org/pypi/mock>`_ package,
but with the benefit of not having to worry about undoing patches at the end
of a test:
Expand All @@ -16,28 +17,29 @@ of a test:
Usage
-----
=====

The ``mock`` fixture has the same API as
`mock.patch <http://www.voidspace.org.uk/python/mock/patch.html#patch-decorators>`_,
supporting the same arguments:

.. code-block:: python
# all valid calls
mock.patch('os.remove')
mock.patch.object(os, 'listdir', autospec=True)
mocked = mock.patch('os.remove')
def test_foo(mock):
# all valid calls
mock.patch('os.remove')
mock.patch.object(os, 'listdir', autospec=True)
mocked = mock.patch('os.path.isfile')
The supported methods are:

* ``mock.patch``: see http://www.voidspace.org.uk/python/mock/patch.html#patch.
* ``mock.patch.object``: see `http://www.voidspace.org.uk/python/mock/patch.html#patch-object.
* ``mock.patch.multiple``: see `http://www.voidspace.org.uk/python/mock/patch.html#patch-multiple.
* ``mock.patch.object``: see http://www.voidspace.org.uk/python/mock/patch.html#patch-object.
* ``mock.patch.multiple``: see http://www.voidspace.org.uk/python/mock/patch.html#patch-multiple.
* ``mock.stopall()``: stops all active patches at this point.

Why bother with a plugin?
-------------------------
=========================

There are a number of different ``patch`` usages in the standard ``mock`` API,
but IMHO they don't scale very well when you have a more than one or two
Expand Down
3 changes: 3 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[bdist_wheel]
universal = 1

4 changes: 4 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,18 @@
author='Bruno Oliveira',
author_email='[email protected]',
description='Thin-wrapper around the mock package for easier use with py.test',
long_description=open('README.rst').read(),
keywords="pytest mock",
classifiers=[
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)',
'Operating System :: OS Independent',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.2',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Topic :: Software Development :: Testing',
]
Expand Down

0 comments on commit 22d194d

Please sign in to comment.