Hello community,
here is the log from the commit of package python-pytest-mock for
openSUSE:Factory checked in at 2017-10-21 20:20:13
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-pytest-mock (Old)
and /work/SRC/openSUSE:Factory/.python-pytest-mock.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pytest-mock"
Sat Oct 21 20:20:13 2017 rev:3 rq:533466 version:1.6.3
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-pytest-mock/python-pytest-mock.changes
2017-08-14 12:38:53.725476550 +0200
+++
/work/SRC/openSUSE:Factory/.python-pytest-mock.new/python-pytest-mock.changes
2017-10-21 20:20:33.306430152 +0200
@@ -1,0 +2,11 @@
+Wed Oct 11 14:45:16 UTC 2017 - [email protected]
+
+- Update to version 1.6.3:
+ * Fix UnicodeDecodeError during assert introspection in
+ assert_called_with in Python 2.
+ * Provide source package in tar.gz format and remove obsolete
+ MANIFEST.in.
+ * Fix mocker.resetall() by ignoring mocker objects which don't
+ have a resetall method, like for example patch.dict
+
+-------------------------------------------------------------------
Old:
----
pytest-mock-1.6.0.tar.gz
New:
----
pytest-mock-1.6.3.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-pytest-mock.spec ++++++
--- /var/tmp/diff_new_pack.ezle7C/_old 2017-10-21 20:20:34.018396812 +0200
+++ /var/tmp/diff_new_pack.ezle7C/_new 2017-10-21 20:20:34.018396812 +0200
@@ -19,7 +19,7 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define modname pytest-mock
Name: python-%{modname}
-Version: 1.6.0
+Version: 1.6.3
Release: 0
Summary: Thin-wrapper around the mock package for easier use with pytest
License: MIT
++++++ pytest-mock-1.6.0.tar.gz -> pytest-mock-1.6.3.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-mock-1.6.0/.travis.yml
new/pytest-mock-1.6.3/.travis.yml
--- old/pytest-mock-1.6.0/.travis.yml 2017-03-31 00:53:21.000000000 +0200
+++ new/pytest-mock-1.6.3/.travis.yml 2017-09-16 01:54:12.000000000 +0200
@@ -1,43 +1,19 @@
language: python
python:
+ - "2.6"
+ - "2.7"
+ - "3.3"
+ - "3.4"
- "3.5"
-
-env:
- - TOXENV=py26-pytest27
- - TOXENV=py26-pytest28
- - TOXENV=py26-pytest29
- - TOXENV=py26-pytest30
- - TOXENV=py27-pytest27
- - TOXENV=py27-pytest28
- - TOXENV=py27-pytest29
- - TOXENV=py27-pytest30
- - TOXENV=py33-pytest27
- - TOXENV=py33-pytest28
- - TOXENV=py33-pytest29
- - TOXENV=py33-pytest30
- - TOXENV=py34-pytest27
- - TOXENV=py34-pytest28
- - TOXENV=py34-pytest29
- - TOXENV=py34-pytest30
- - TOXENV=py35-pytest27
- - TOXENV=py35-pytest28
- - TOXENV=py35-pytest29
- - TOXENV=py35-pytest30
- - TOXENV=linting
+ - "3.6"
matrix:
include:
- - env: TOXENV=py36-pytest27
- python: '3.6'
- - env: TOXENV=py36-pytest28
- python: '3.6'
- - env: TOXENV=py36-pytest29
- python: '3.6'
- - env: TOXENV=py36-pytest30
- python: '3.6'
+ - python: '3.6'
+ env: TOXENV=linting
install:
- - pip install tox coveralls
+ - pip install tox-travis coveralls
script:
- tox
@@ -49,10 +25,10 @@
provider: pypi
user: nicoddemus
skip_upload_docs: true
+ distributions: sdist bdist_wheel
password:
- secure:
bB4adUZVIkt31cmNklskyIDNehujKToGnStnlunp7P8CBF6CGeNqkYU17emAPvfZbTb/ClUpiO9r6AD1ej32Uyr+I8qUyhuYtHG3JGp+WRR/tw+ytAZIJ9i+PMjBv1RAdyLENJ/Tx0LKHKsABr8dQIieLFqKZJuT77f/5ZkvI/U=
+ secure:
OEWrbk09CZRrwFE6sBpRqQHu45zRu1S0Ly1ZeprkFCKxMd9tZOnrYM5qxCDQXxFHIvuyajuJ+qWTOgxUvurQMNsD6DbvJKTJ0R8upH1b1Q95KK8xiJFedhqBEUga5GrInK59oo0Sgblse2jtH5NnHXRUClSdT+iHdLY5sljCTRg=
on:
tags: true
- distributions: sdist bdist_wheel
repo: pytest-dev/pytest-mock
- condition: $TRAVIS_PYTHON_VERSION = 3.5
+ condition: $TRAVIS_PYTHON_VERSION = 3.6
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-mock-1.6.0/CHANGELOG.rst
new/pytest-mock-1.6.3/CHANGELOG.rst
--- old/pytest-mock-1.6.0/CHANGELOG.rst 2017-03-31 00:53:21.000000000 +0200
+++ new/pytest-mock-1.6.3/CHANGELOG.rst 2017-09-16 01:54:12.000000000 +0200
@@ -1,3 +1,30 @@
+1.6.3
+-----
+
+* Fix ``UnicodeDecodeError`` during assert introspection in
``assert_called_with`` in Python 2.
+ Thanks `@AndreasHogstrom`_ for the report (`#91`_).
+
+
+.. _@AndreasHogstrom: https://github.com/AndreasHogstrom
+
+.. _#91: https://github.com/pytest-dev/pytest-mock/issues/91
+
+1.6.2
+-----
+
+* Provide source package in ``tar.gz`` format and remove obsolete
``MANIFEST.in``.
+
+1.6.1
+-----
+
+* Fix ``mocker.resetall()`` by ignoring mocker objects which don't have a
+ ``resetall`` method, like for example ``patch.dict``.
+ Thanks `@jdavisp3`_ for the PR (`#88`_).
+
+.. _@jdavisp3: https://github.com/jdavisp3
+
+.. _#88: https://github.com/pytest-dev/pytest-mock/pull/88
+
1.6.0
-----
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-mock-1.6.0/MANIFEST.in
new/pytest-mock-1.6.3/MANIFEST.in
--- old/pytest-mock-1.6.0/MANIFEST.in 2017-03-31 00:53:21.000000000 +0200
+++ new/pytest-mock-1.6.3/MANIFEST.in 1970-01-01 01:00:00.000000000 +0100
@@ -1,2 +0,0 @@
-include README.md
-include LICENSE
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-mock-1.6.0/PKG-INFO
new/pytest-mock-1.6.3/PKG-INFO
--- old/pytest-mock-1.6.0/PKG-INFO 2017-03-31 00:53:43.000000000 +0200
+++ new/pytest-mock-1.6.3/PKG-INFO 2017-09-16 01:54:59.000000000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: pytest-mock
-Version: 1.6.0
+Version: 1.6.3
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
@@ -17,7 +17,14 @@
.. code-block:: python
-
+ import os
+
+ class UnixFS:
+
+ @staticmethod
+ def rm(filename):
+ os.remove(filename)
+
def test_unix_fs(mocker):
mocker.patch('os.remove')
UnixFS.rm('file')
@@ -275,9 +282,13 @@
- you can't easily undo the mocking during the test execution;
- **Note**
+ **Note about usage as context manager**
- Although mocker's API is intentionally the same as ``mock.patch``'s,
its uses as context managers and function decorators are **not** supported. The
purpose of this plugin is to make the use of context managers and function
decorators for mocking unnecessary. Indeed, trying to use the functionality in
``mocker`` in this manner can lead to non-intuitive errors:
+ Although mocker's API is intentionally the same as ``mock.patch``'s,
its use
+ as context manager and function decorator is **not** supported through
the
+ fixture. The purpose of this plugin is to make the use of context
managers and
+ function decorators for mocking unnecessary. Indeed, trying to use the
+ functionality in ``mocker`` in this manner can lead to non-intuitive
errors:
.. code-block:: python
@@ -294,6 +305,23 @@
with mocker.patch.object(a, 'doIt', return_value=True,
autospec=True):
E AttributeError: __exit__
+ You can however use ``mocker.mock_module`` to access the underlying
``mock``
+ module, e.g. to return a context manager in a fixture that mocks
something
+ temporarily:
+
+ .. code-block:: python
+
+ @pytest.fixture
+ def fixture_cm(mocker):
+ @contextlib.contextmanager
+ def my_cm():
+ def mocked():
+ pass
+
+ with mocker.mock_module.patch.object(SomeClass, 'method',
mocked):
+ yield
+ return my_cm
+
License
=======
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-mock-1.6.0/README.rst
new/pytest-mock-1.6.3/README.rst
--- old/pytest-mock-1.6.0/README.rst 2017-03-31 00:53:21.000000000 +0200
+++ new/pytest-mock-1.6.3/README.rst 2017-09-16 01:54:12.000000000 +0200
@@ -9,7 +9,14 @@
.. code-block:: python
-
+ import os
+
+ class UnixFS:
+
+ @staticmethod
+ def rm(filename):
+ os.remove(filename)
+
def test_unix_fs(mocker):
mocker.patch('os.remove')
UnixFS.rm('file')
@@ -267,9 +274,13 @@
- you can't easily undo the mocking during the test execution;
-**Note**
+**Note about usage as context manager**
-Although mocker's API is intentionally the same as ``mock.patch``'s, its uses
as context managers and function decorators are **not** supported. The purpose
of this plugin is to make the use of context managers and function decorators
for mocking unnecessary. Indeed, trying to use the functionality in ``mocker``
in this manner can lead to non-intuitive errors:
+Although mocker's API is intentionally the same as ``mock.patch``'s, its use
+as context manager and function decorator is **not** supported through the
+fixture. The purpose of this plugin is to make the use of context managers and
+function decorators for mocking unnecessary. Indeed, trying to use the
+functionality in ``mocker`` in this manner can lead to non-intuitive errors:
.. code-block:: python
@@ -286,6 +297,23 @@
with mocker.patch.object(a, 'doIt', return_value=True, autospec=True):
E AttributeError: __exit__
+You can however use ``mocker.mock_module`` to access the underlying ``mock``
+module, e.g. to return a context manager in a fixture that mocks something
+temporarily:
+
+.. code-block:: python
+
+ @pytest.fixture
+ def fixture_cm(mocker):
+ @contextlib.contextmanager
+ def my_cm():
+ def mocked():
+ pass
+
+ with mocker.mock_module.patch.object(SomeClass, 'method', mocked):
+ yield
+ return my_cm
+
License
=======
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-mock-1.6.0/_pytest_mock_version.py
new/pytest-mock-1.6.3/_pytest_mock_version.py
--- old/pytest-mock-1.6.0/_pytest_mock_version.py 2017-03-31
00:53:43.000000000 +0200
+++ new/pytest-mock-1.6.3/_pytest_mock_version.py 2017-09-16
01:54:59.000000000 +0200
@@ -1,4 +1,4 @@
# coding: utf-8
# file generated by setuptools_scm
# don't change, don't track in version control
-version = '1.6.0'
+version = '1.6.3'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-mock-1.6.0/pytest_mock.egg-info/PKG-INFO
new/pytest-mock-1.6.3/pytest_mock.egg-info/PKG-INFO
--- old/pytest-mock-1.6.0/pytest_mock.egg-info/PKG-INFO 2017-03-31
00:53:43.000000000 +0200
+++ new/pytest-mock-1.6.3/pytest_mock.egg-info/PKG-INFO 2017-09-16
01:54:59.000000000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: pytest-mock
-Version: 1.6.0
+Version: 1.6.3
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
@@ -17,7 +17,14 @@
.. code-block:: python
-
+ import os
+
+ class UnixFS:
+
+ @staticmethod
+ def rm(filename):
+ os.remove(filename)
+
def test_unix_fs(mocker):
mocker.patch('os.remove')
UnixFS.rm('file')
@@ -275,9 +282,13 @@
- you can't easily undo the mocking during the test execution;
- **Note**
+ **Note about usage as context manager**
- Although mocker's API is intentionally the same as ``mock.patch``'s,
its uses as context managers and function decorators are **not** supported. The
purpose of this plugin is to make the use of context managers and function
decorators for mocking unnecessary. Indeed, trying to use the functionality in
``mocker`` in this manner can lead to non-intuitive errors:
+ Although mocker's API is intentionally the same as ``mock.patch``'s,
its use
+ as context manager and function decorator is **not** supported through
the
+ fixture. The purpose of this plugin is to make the use of context
managers and
+ function decorators for mocking unnecessary. Indeed, trying to use the
+ functionality in ``mocker`` in this manner can lead to non-intuitive
errors:
.. code-block:: python
@@ -294,6 +305,23 @@
with mocker.patch.object(a, 'doIt', return_value=True,
autospec=True):
E AttributeError: __exit__
+ You can however use ``mocker.mock_module`` to access the underlying
``mock``
+ module, e.g. to return a context manager in a fixture that mocks
something
+ temporarily:
+
+ .. code-block:: python
+
+ @pytest.fixture
+ def fixture_cm(mocker):
+ @contextlib.contextmanager
+ def my_cm():
+ def mocked():
+ pass
+
+ with mocker.mock_module.patch.object(SomeClass, 'method',
mocked):
+ yield
+ return my_cm
+
License
=======
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-mock-1.6.0/pytest_mock.egg-info/SOURCES.txt
new/pytest-mock-1.6.3/pytest_mock.egg-info/SOURCES.txt
--- old/pytest-mock-1.6.0/pytest_mock.egg-info/SOURCES.txt 2017-03-31
00:53:43.000000000 +0200
+++ new/pytest-mock-1.6.3/pytest_mock.egg-info/SOURCES.txt 2017-09-16
01:54:59.000000000 +0200
@@ -2,7 +2,6 @@
.travis.yml
CHANGELOG.rst
LICENSE
-MANIFEST.in
README.rst
_pytest_mock_version.py
appveyor.yml
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-mock-1.6.0/pytest_mock.py
new/pytest-mock-1.6.3/pytest_mock.py
--- old/pytest-mock-1.6.0/pytest_mock.py 2017-03-31 00:53:21.000000000
+0200
+++ new/pytest-mock-1.6.3/pytest_mock.py 2017-09-16 01:54:12.000000000
+0200
@@ -1,3 +1,5 @@
+from __future__ import unicode_literals
+
import inspect
import sys
@@ -7,6 +9,12 @@
__version__ = version
+# pseudo-six; if this starts to require more than this, depend on six already
+if sys.version_info[0] == 2: # pragma: no cover
+ text_type = unicode # noqa
+else:
+ text_type = str
+
def _get_mock_module(config):
"""
@@ -124,7 +132,8 @@
p = mock_func(*args, **kwargs)
mocked = p.start()
self._patches.append(p)
- self._mocks.append(mocked)
+ if hasattr(mocked, 'reset_mock'):
+ self._mocks.append(mocked)
return mocked
def object(self, *args, **kwargs):
@@ -178,21 +187,21 @@
return
except AssertionError as e:
if getattr(e, '_mock_introspection_applied', 0):
- msg = str(e)
+ msg = text_type(e)
else:
__mock_self = args[0]
- msg = str(e)
+ msg = text_type(e)
if __mock_self.call_args is not None:
actual_args, actual_kwargs = __mock_self.call_args
msg += '\n\npytest introspection follows:\n'
try:
assert actual_args == args[1:]
except AssertionError as e:
- msg += '\nArgs:\n' + str(e)
+ msg += '\nArgs:\n' + text_type(e)
try:
assert actual_kwargs == kwargs
except AssertionError as e:
- msg += '\nKwargs:\n' + str(e)
+ msg += '\nKwargs:\n' + text_type(e)
e = AssertionError(msg)
e._mock_introspection_applied = True
raise e
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-mock-1.6.0/setup.cfg
new/pytest-mock-1.6.3/setup.cfg
--- old/pytest-mock-1.6.0/setup.cfg 2017-03-31 00:53:43.000000000 +0200
+++ new/pytest-mock-1.6.3/setup.cfg 2017-09-16 01:54:59.000000000 +0200
@@ -2,7 +2,6 @@
universal = 1
[egg_info]
-tag_date = 0
tag_build =
-tag_svn_revision = 0
+tag_date = 0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-mock-1.6.0/test_pytest_mock.py
new/pytest-mock-1.6.3/test_pytest_mock.py
--- old/pytest-mock-1.6.0/test_pytest_mock.py 2017-03-31 00:53:21.000000000
+0200
+++ new/pytest-mock-1.6.3/test_pytest_mock.py 2017-09-16 01:54:12.000000000
+0200
@@ -86,6 +86,8 @@
mock_fs(mocker)
mocked_rm, mocked_ls = mock_fs(mocker)
check_unix_fs_mocked(mocked_rm, mocked_ls)
+ mocker.resetall()
+ mocker.stopall()
def test_mock_patch_dict(mocker):
@@ -100,23 +102,16 @@
assert x == {'original': 1}
-def test_mock_fixture_is_deprecated(testdir):
+def test_mock_patch_dict_resetall(mocker):
"""
- Test that a warning emitted when using deprecated "mock" fixture.
+ We can call resetall after patching a dict.
+ :param mock:
"""
- testdir.makepyfile('''
- import warnings
- import os
- warnings.simplefilter('always')
-
- def test_foo(mock, tmpdir):
- mock.patch('os.listdir', return_value=['mocked'])
- assert os.listdir(str(tmpdir)) == ['mocked']
- mock.stopall()
- assert os.listdir(str(tmpdir)) == []
- ''')
- result = testdir.runpytest('-s')
- result.stderr.fnmatch_lines(['*"mock" fixture has been deprecated*'])
+ x = {'original': 1}
+ mocker.patch.dict(x, values=[('new', 10)], clear=True)
+ assert x == {'new': 10}
+ mocker.resetall()
+ assert x == {'new': 10}
def test_deprecated_mock(mock, tmpdir):
@@ -539,3 +534,13 @@
"*{'bar': 4}*",
"*Use -v to get the full diff*",
])
+
+
+def test_assert_called_with_unicode_arguments(mocker):
+ """Test bug in assert_call_with called with non-ascii unicode string
(#91)"""
+ stub = mocker.stub()
+ stub(b'l\xc3\xb6k'.decode('UTF-8'))
+
+ with pytest.raises(AssertionError):
+ stub.assert_called_with(u'lak')
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-mock-1.6.0/tox.ini
new/pytest-mock-1.6.3/tox.ini
--- old/pytest-mock-1.6.0/tox.ini 2017-03-31 00:53:21.000000000 +0200
+++ new/pytest-mock-1.6.3/tox.ini 2017-09-16 01:54:12.000000000 +0200
@@ -13,7 +13,6 @@
coverage run --append --source=pytest_mock.py -m pytest test_pytest_mock.py
[testenv:linting]
-basepython = python3.5
skip_install=True
deps =
pytest-flakes