New upstream version 1.7.1

This commit is contained in:
Ghislain Antony Vaillant 2018-03-05 22:30:36 +00:00
parent 506682a7c5
commit cde0d28bf2
11 changed files with 136 additions and 58 deletions

4
.gitignore vendored
View file

@ -31,6 +31,7 @@ htmlcov/
.tox/
.coverage
.cache
.pytest_cache
nosetests.xml
coverage.xml
@ -56,3 +57,6 @@ docs/_build/
.env*
_pytest_mock_version.py
# IDE
.idea

View file

@ -1,17 +1,10 @@
language: python
python:
- "2.6"
- "2.7"
- "3.3"
- "3.4"
- "3.5"
- "3.6"
matrix:
include:
- python: '3.6'
env: TOXENV=linting
install:
- pip install tox-travis coveralls
@ -21,14 +14,23 @@ script:
after_success:
- coveralls
deploy:
provider: pypi
user: nicoddemus
skip_upload_docs: true
distributions: sdist bdist_wheel
password:
secure: OEWrbk09CZRrwFE6sBpRqQHu45zRu1S0Ly1ZeprkFCKxMd9tZOnrYM5qxCDQXxFHIvuyajuJ+qWTOgxUvurQMNsD6DbvJKTJ0R8upH1b1Q95KK8xiJFedhqBEUga5GrInK59oo0Sgblse2jtH5NnHXRUClSdT+iHdLY5sljCTRg=
on:
tags: true
repo: pytest-dev/pytest-mock
condition: $TRAVIS_PYTHON_VERSION = 3.6
jobs:
include:
- python: '3.6'
env: TOXENV=linting
- python: '3.6'
env: TOXENV=norewrite
- stage: deploy
python: '3.6'
install: pip install -U setuptools setuptools_scm
script: skip
deploy:
provider: pypi
user: nicoddemus
skip_upload_docs: true
distributions: sdist bdist_wheel
password:
secure: OEWrbk09CZRrwFE6sBpRqQHu45zRu1S0Ly1ZeprkFCKxMd9tZOnrYM5qxCDQXxFHIvuyajuJ+qWTOgxUvurQMNsD6DbvJKTJ0R8upH1b1Q95KK8xiJFedhqBEUga5GrInK59oo0Sgblse2jtH5NnHXRUClSdT+iHdLY5sljCTRg=
on:
tags: true
repo: pytest-dev/pytest-mock

View file

@ -1,3 +1,32 @@
1.7.1
-----
* Fix ``setup.py`` to correctly read the ``README.rst``. Thanks `@ghisvail`_ for the fix (`#107`_).
.. _#107: https://github.com/pytest-dev/pytest-mock/issues/107
1.7.0
-----
**Incompatible change**
* ``pytest-mock`` no longer supports Python 2.6 and Python 3.3, following the lead of
``pytest`` and other projects in the community. Thanks `@hugovk`_ for the PR (`#96`_).
**Packaging**
* Fix ``mock`` requirement in Python 2. Thanks `@ghisvail`_ for the report (`#101`_).
**Internal**
* Some tests in ``pytest-mock``'s suite are skipped if assertion rewriting is disabled (`#102`_).
.. _@ghisvail: https://github.com/ghisvail
.. _@hugovk: https://github.com/hugovk
.. _#96: https://github.com/pytest-dev/pytest-mock/pull/96
.. _#101: https://github.com/pytest-dev/pytest-mock/issues/101
.. _#102: https://github.com/pytest-dev/pytest-mock/issues/102
1.6.3
-----

View file

@ -1,11 +1,12 @@
Metadata-Version: 1.1
Metadata-Version: 1.2
Name: pytest-mock
Version: 1.6.3
Version: 1.7.1
Summary: Thin-wrapper around the mock package for easier use with py.test
Home-page: https://github.com/pytest-dev/pytest-mock/
Author: Bruno Oliveira
Author-email: nicoddemus@gmail.com
License: MIT
Description-Content-Type: UNKNOWN
Description: ===========
pytest-mock
===========
@ -52,6 +53,13 @@ Description: ===========
.. |python| image:: https://img.shields.io/pypi/pyversions/pytest-mock.svg
:target: https://pypi.python.org/pypi/pytest-mock/
.. image:: http://www.opensourcecitizen.org/badge?url=github.com/pytest-dev/pytest-mock
:target: http://www.opensourcecitizen.org/project?url=github.com/pytest-dev/pytest-mock
If you found this library useful, donate some CPU cycles to its
development efforts by clicking above. Thank you! 😇
Usage
=====
@ -161,10 +169,10 @@ Description: ===========
E Right contains more items:
E {'bar': 4}
E Use -v to get the full diff
test_foo.py:6: AssertionError
========================== 1 failed in 0.03 seconds ===========================
test_foo.py:6: AssertionError
========================== 1 failed in 0.03 seconds ===========================
This is useful when asserting mock calls with many/nested arguments and trying
@ -199,14 +207,14 @@ Description: ===========
mock_use_standalone_module = true
This will force the plugin to import ``mock`` instead of the ``unittest.mock`` module bundled with
Python 3.3+. Note that this option is only used in Python 3+, as Python 2 users only have the option
Python 3.4+. Note that this option is only used in Python 3+, as Python 2 users only have the option
to use the ``mock`` package from PyPI anyway.
Requirements
============
* Python 2.6+, Python 3.3+
* Python 2.7, Python 3.4+
* pytest
* mock (for Python 2)
@ -337,11 +345,11 @@ Classifier: Framework :: Pytest
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Topic :: Software Development :: Testing
Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*

View file

@ -44,6 +44,13 @@ of a test:
.. |python| image:: https://img.shields.io/pypi/pyversions/pytest-mock.svg
:target: https://pypi.python.org/pypi/pytest-mock/
.. image:: http://www.opensourcecitizen.org/badge?url=github.com/pytest-dev/pytest-mock
:target: http://www.opensourcecitizen.org/project?url=github.com/pytest-dev/pytest-mock
If you found this library useful, donate some CPU cycles to its
development efforts by clicking above. Thank you! 😇
Usage
=====
@ -153,10 +160,10 @@ diff::
E Right contains more items:
E {'bar': 4}
E Use -v to get the full diff
test_foo.py:6: AssertionError
========================== 1 failed in 0.03 seconds ===========================
test_foo.py:6: AssertionError
========================== 1 failed in 0.03 seconds ===========================
This is useful when asserting mock calls with many/nested arguments and trying
@ -191,14 +198,14 @@ than the one that comes with the Python distribution.
mock_use_standalone_module = true
This will force the plugin to import ``mock`` instead of the ``unittest.mock`` module bundled with
Python 3.3+. Note that this option is only used in Python 3+, as Python 2 users only have the option
Python 3.4+. Note that this option is only used in Python 3+, as Python 2 users only have the option
to use the ``mock`` package from PyPI anyway.
Requirements
============
* Python 2.6+, Python 3.3+
* Python 2.7, Python 3.4+
* pytest
* mock (for Python 2)

View file

@ -1,4 +1,4 @@
# coding: utf-8
# file generated by setuptools_scm
# don't change, don't track in version control
version = '1.6.3'
version = '1.7.1'

View file

@ -1,11 +1,12 @@
Metadata-Version: 1.1
Metadata-Version: 1.2
Name: pytest-mock
Version: 1.6.3
Version: 1.7.1
Summary: Thin-wrapper around the mock package for easier use with py.test
Home-page: https://github.com/pytest-dev/pytest-mock/
Author: Bruno Oliveira
Author-email: nicoddemus@gmail.com
License: MIT
Description-Content-Type: UNKNOWN
Description: ===========
pytest-mock
===========
@ -52,6 +53,13 @@ Description: ===========
.. |python| image:: https://img.shields.io/pypi/pyversions/pytest-mock.svg
:target: https://pypi.python.org/pypi/pytest-mock/
.. image:: http://www.opensourcecitizen.org/badge?url=github.com/pytest-dev/pytest-mock
:target: http://www.opensourcecitizen.org/project?url=github.com/pytest-dev/pytest-mock
If you found this library useful, donate some CPU cycles to its
development efforts by clicking above. Thank you! 😇
Usage
=====
@ -161,10 +169,10 @@ Description: ===========
E Right contains more items:
E {'bar': 4}
E Use -v to get the full diff
test_foo.py:6: AssertionError
========================== 1 failed in 0.03 seconds ===========================
test_foo.py:6: AssertionError
========================== 1 failed in 0.03 seconds ===========================
This is useful when asserting mock calls with many/nested arguments and trying
@ -199,14 +207,14 @@ Description: ===========
mock_use_standalone_module = true
This will force the plugin to import ``mock`` instead of the ``unittest.mock`` module bundled with
Python 3.3+. Note that this option is only used in Python 3+, as Python 2 users only have the option
Python 3.4+. Note that this option is only used in Python 3+, as Python 2 users only have the option
to use the ``mock`` package from PyPI anyway.
Requirements
============
* Python 2.6+, Python 3.3+
* Python 2.7, Python 3.4+
* pytest
* mock (for Python 2)
@ -337,11 +345,11 @@ Classifier: Framework :: Pytest
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Topic :: Software Development :: Testing
Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*

View file

@ -1,4 +1,4 @@
pytest>=2.7
[:python_version=="2.6" or python_version=="2.7"]
[:python_version < "3.0"]
mock

View file

@ -1,5 +1,6 @@
from setuptools import setup
from io import open
setup(
name='pytest-mock',
@ -8,12 +9,11 @@ setup(
},
py_modules=['pytest_mock', '_pytest_mock_version'],
platforms='any',
python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*',
install_requires=[
'pytest>=2.7',
'mock;python_version<"3.0"',
],
extras_require={
':python_version=="2.6" or python_version=="2.7"': ['mock'],
},
use_scm_version={'write_to': '_pytest_mock_version.py'},
setup_requires=['setuptools_scm'],
url='https://github.com/pytest-dev/pytest-mock/',
@ -21,7 +21,7 @@ setup(
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(),
long_description=open('README.rst', encoding='utf-8').read(),
keywords="pytest mock",
classifiers=[
'Development Status :: 5 - Production/Stable',
@ -29,10 +29,9 @@ setup(
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',

View file

@ -13,6 +13,19 @@ skip_pypy = pytest.mark.skipif(platform.python_implementation() == 'PyPy',
reason='could not make work on pypy')
@pytest.fixture
def needs_assert_rewrite(pytestconfig):
"""
Fixture which skips requesting test if assertion rewrite is disabled (#102)
Making this a fixture to avoid acessing pytest's config in the global context.
"""
option = pytestconfig.getoption('assertmode')
if option != 'rewrite':
pytest.skip('this test needs assertion rewrite to work but current option '
'is "{}"'.format(option))
class UnixFS(object):
"""
Wrapper to os functions to simulate a Unix file system, used for testing
@ -348,8 +361,8 @@ def assert_argument_introspection(left, right):
raise AssertionError("DID NOT RAISE")
@pytest.mark.skipif(sys.version_info[:2] in [(3, 3), (3, 4)],
reason="assert_not_called not available in python 3.3 and 3.4")
@pytest.mark.skipif(sys.version_info[:2] == (3, 4),
reason="assert_not_called not available in Python 3.4")
def test_assert_not_called_wrapper(mocker):
stub = mocker.stub()
stub.assert_not_called()
@ -375,6 +388,7 @@ def test_assert_called_once_with_wrapper(mocker):
stub.assert_called_once_with("foo")
@pytest.mark.usefixtures('needs_assert_rewrite')
def test_assert_called_args_with_introspection(mocker):
stub = mocker.stub()
@ -390,6 +404,7 @@ def test_assert_called_args_with_introspection(mocker):
stub.assert_called_once_with(*wrong_args)
@pytest.mark.usefixtures('needs_assert_rewrite')
def test_assert_called_kwargs_with_introspection(mocker):
stub = mocker.stub()
@ -510,6 +525,7 @@ def runpytest_subprocess(testdir, *args):
return testdir.runpytest(*args)
@pytest.mark.usefixtures('needs_assert_rewrite')
def test_detailed_introspection(testdir):
"""Check that the "mock_use_standalone" is being used.
"""

13
tox.ini
View file

@ -1,17 +1,22 @@
[tox]
envlist = py{26,27,33,34,35,36}-pytest{27,28,29,30},linting
envlist = py{27,34,35,36}-pytest{30,31,32,33,34},linting,norewrite
[testenv]
passenv = USER USERNAME
deps =
coverage
pytest27: pytest~=2.7
pytest28: pytest~=2.8
pytest29: pytest~=2.9
pytest30: pytest~=3.0
pytest31: pytest~=3.1
pytest32: pytest~=3.2
pytest33: pytest~=3.3
pytest34: pytest~=3.4
commands =
coverage run --append --source=pytest_mock.py -m pytest test_pytest_mock.py
[testenv:norewrite]
commands =
pytest test_pytest_mock.py --assert=plain -ra
[testenv:linting]
skip_install=True
deps =