From 22d194d02af8cca7d815de52b849f90b59cfcdec Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Thu, 17 Jul 2014 00:19:56 -0300 Subject: [PATCH] Adjustments for PyPI release --- README.rst | 20 +++++++++++--------- setup.cfg | 3 +++ setup.py | 4 ++++ 3 files changed, 18 insertions(+), 9 deletions(-) create mode 100644 setup.cfg diff --git a/README.rst b/README.rst index 2bfb9b7..426a8a3 100644 --- a/README.rst +++ b/README.rst @@ -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 `_ package, but with the benefit of not having to worry about undoing patches at the end of a test: @@ -16,7 +17,7 @@ of a test: Usage ------ +===== The ``mock`` fixture has the same API as `mock.patch `_, @@ -24,20 +25,21 @@ 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 diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..b8a1655 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,3 @@ +[bdist_wheel] +universal = 1 + diff --git a/setup.py b/setup.py index b0be881..afa8703 100644 --- a/setup.py +++ b/setup.py @@ -21,14 +21,18 @@ author='Bruno Oliveira', author_email='nicoddemus@gmail.com', 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', ]