Hello community, here is the log from the commit of package python-pytest-mock for openSUSE:Factory checked in at 2019-03-29 20:37:41 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-pytest-mock (Old) and /work/SRC/openSUSE:Factory/.python-pytest-mock.new.25356 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pytest-mock" Fri Mar 29 20:37:41 2019 rev:9 rq:688629 version:1.10.2 Changes: -------- --- /work/SRC/openSUSE:Factory/python-pytest-mock/python-pytest-mock.changes 2019-02-24 17:05:25.228622671 +0100 +++ /work/SRC/openSUSE:Factory/.python-pytest-mock.new.25356/python-pytest-mock.changes 2019-03-29 20:37:43.634648758 +0100 @@ -1,0 +2,7 @@ +Tue Mar 26 09:33:33 UTC 2019 - John Vandenberg <[email protected]> + +- Update to v1.10.2 + * Fix bug at the end of the test session when a call to + patch.stopall is done explicitly by user code. + +------------------------------------------------------------------- Old: ---- pytest-mock-1.10.1.tar.gz New: ---- pytest-mock-1.10.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-pytest-mock.spec ++++++ --- /var/tmp/diff_new_pack.LtYzjC/_old 2019-03-29 20:37:44.318649140 +0100 +++ /var/tmp/diff_new_pack.LtYzjC/_new 2019-03-29 20:37:44.322649142 +0100 @@ -20,7 +20,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} %bcond_without python2 Name: python-pytest-mock -Version: 1.10.1 +Version: 1.10.2 Release: 0 Summary: Thin-wrapper around the mock package for easier use with pytest License: MIT ++++++ pytest-mock-1.10.1.tar.gz -> pytest-mock-1.10.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-mock-1.10.1/CHANGELOG.rst new/pytest-mock-1.10.2/CHANGELOG.rst --- old/pytest-mock-1.10.1/CHANGELOG.rst 2019-02-04 14:32:41.000000000 +0100 +++ new/pytest-mock-1.10.2/CHANGELOG.rst 2019-03-25 12:55:25.000000000 +0100 @@ -1,3 +1,12 @@ +1.10.2 +------ + +* Fix bug at the end of the test session when a call to ``patch.stopall`` is done explicitly by + user code. Thanks `@craiga`_ for the report (`#137`_). + +.. _#137: https://github.com/pytest-dev/pytest-mock/issues/137 +.. _@craiga: https://github.com/craiga + 1.10.1 ------ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-mock-1.10.1/PKG-INFO new/pytest-mock-1.10.2/PKG-INFO --- old/pytest-mock-1.10.1/PKG-INFO 2019-02-04 14:33:00.000000000 +0100 +++ new/pytest-mock-1.10.2/PKG-INFO 2019-03-25 12:55:44.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: pytest-mock -Version: 1.10.1 +Version: 1.10.2 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 @@ -55,6 +55,8 @@ .. |black| image:: https://img.shields.io/badge/code%20style-black-000000.svg :target: https://github.com/ambv/black + `Professionally supported pytest-mock is now available <https://tidelift.com/subscription/pkg/pypi-pytest_mock?utm_source=pypi-pytest-mock&utm_medium=referral&utm_campaign=readme>`_ + Usage ===== diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-mock-1.10.1/README.rst new/pytest-mock-1.10.2/README.rst --- old/pytest-mock-1.10.1/README.rst 2019-02-04 14:32:41.000000000 +0100 +++ new/pytest-mock-1.10.2/README.rst 2019-03-25 12:55:25.000000000 +0100 @@ -47,6 +47,8 @@ .. |black| image:: https://img.shields.io/badge/code%20style-black-000000.svg :target: https://github.com/ambv/black +`Professionally supported pytest-mock is now available <https://tidelift.com/subscription/pkg/pypi-pytest_mock?utm_source=pypi-pytest-mock&utm_medium=referral&utm_campaign=readme>`_ + Usage ===== diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-mock-1.10.1/_pytest_mock_version.py new/pytest-mock-1.10.2/_pytest_mock_version.py --- old/pytest-mock-1.10.1/_pytest_mock_version.py 2019-02-04 14:33:00.000000000 +0100 +++ new/pytest-mock-1.10.2/_pytest_mock_version.py 2019-03-25 12:55:44.000000000 +0100 @@ -1,4 +1,4 @@ # coding: utf-8 # file generated by setuptools_scm # don't change, don't track in version control -version = '1.10.1' +version = '1.10.2' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-mock-1.10.1/pytest_mock.egg-info/PKG-INFO new/pytest-mock-1.10.2/pytest_mock.egg-info/PKG-INFO --- old/pytest-mock-1.10.1/pytest_mock.egg-info/PKG-INFO 2019-02-04 14:33:00.000000000 +0100 +++ new/pytest-mock-1.10.2/pytest_mock.egg-info/PKG-INFO 2019-03-25 12:55:44.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: pytest-mock -Version: 1.10.1 +Version: 1.10.2 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 @@ -55,6 +55,8 @@ .. |black| image:: https://img.shields.io/badge/code%20style-black-000000.svg :target: https://github.com/ambv/black + `Professionally supported pytest-mock is now available <https://tidelift.com/subscription/pkg/pypi-pytest_mock?utm_source=pypi-pytest-mock&utm_medium=referral&utm_campaign=readme>`_ + Usage ===== diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-mock-1.10.1/pytest_mock.py new/pytest-mock-1.10.2/pytest_mock.py --- old/pytest-mock-1.10.1/pytest_mock.py 2019-02-04 14:32:41.000000000 +0100 +++ new/pytest-mock-1.10.2/pytest_mock.py 2019-03-25 12:55:25.000000000 +0100 @@ -288,7 +288,17 @@ def unwrap_assert_methods(): for patcher in _mock_module_patches: - patcher.stop() + try: + patcher.stop() + except RuntimeError as e: + # a patcher might have been stopped by user code (#137) + # so we need to catch this error here and ignore it; + # unfortunately there's no public API to check if a patch + # has been started, so catching the error it is + if text_type(e) == "stop called on unstarted patcher": + pass + else: + raise _mock_module_patches[:] = [] _mock_module_originals.clear() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-mock-1.10.1/test_pytest_mock.py new/pytest-mock-1.10.2/test_pytest_mock.py --- old/pytest-mock-1.10.1/test_pytest_mock.py 2019-02-04 14:32:41.000000000 +0100 +++ new/pytest-mock-1.10.2/test_pytest_mock.py 2019-03-25 12:55:25.000000000 +0100 @@ -610,3 +610,24 @@ with pytest.raises(AssertionError): stub.assert_called_with(u"lak") + + +def test_plain_stopall(testdir): + """Calling patch.stopall() in a test would cause an error during unconfigure (#137)""" + testdir.makepyfile( + """ + import random + + def get_random_number(): + return random.randint(0, 100) + + def test_get_random_number(mocker): + patcher = mocker.mock_module.patch("random.randint", lambda x, y: 5) + patcher.start() + assert get_random_number() == 5 + mocker.mock_module.patch.stopall() + """ + ) + result = testdir.runpytest_subprocess() + result.stdout.fnmatch_lines("* 1 passed in *") + assert "RuntimeError" not in result.stderr.str() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-mock-1.10.1/tox.ini new/pytest-mock-1.10.2/tox.ini --- old/pytest-mock-1.10.1/tox.ini 2019-02-04 14:32:41.000000000 +0100 +++ new/pytest-mock-1.10.2/tox.ini 2019-03-25 12:55:25.000000000 +0100 @@ -18,3 +18,6 @@ extras = dev basepython = python3.6 commands = pre-commit run --all-files --show-diff-on-failure + +[pytest] +addopts = -ra
