diff --git a/0001-fix-tests-expectations-with-pytest4.patch b/0001-fix-tests-expectations-with-pytest4.patch deleted file mode 100644 index d6d6c1d120dbc0493a3336d39f46ea0ccf9567e8..0000000000000000000000000000000000000000 --- a/0001-fix-tests-expectations-with-pytest4.patch +++ /dev/null @@ -1,50 +0,0 @@ -From b4d1b1166d4d9e5a9df1b1fdea73021c936891b6 Mon Sep 17 00:00:00 2001 -From: baizg1107 -Date: Tue, 12 Jan 2021 10:25:28 +0800 -Subject: [PATCH] fix tests expectations with pytest4 - -reference: https://github.com/nicoddemus/pytest-mock/commit/970e4b1f8cfd6bd750b4c8240efad378cbf049c2 ---- - test_pytest_mock.py | 2 +- - tox.ini | 8 +++++++- - 2 files changed, 8 insertions(+), 2 deletions(-) - -diff --git a/test_pytest_mock.py b/test_pytest_mock.py -index e50b5b8..45dbe3f 100644 ---- a/test_pytest_mock.py -+++ b/test_pytest_mock.py -@@ -585,7 +585,7 @@ def test_detailed_introspection(testdir): - "*Use -v to get the full diff*", - "*Kwargs:*", - "*assert {} == {'bar': 4}*", -- "*Right contains more items:*", -+ "*Right contains* more item*", - "*{'bar': 4}*", - "*Use -v to get the full diff*", - ] -diff --git a/tox.ini b/tox.ini -index 7a270b1..bc9eaa0 100644 ---- a/tox.ini -+++ b/tox.ini -@@ -12,7 +12,7 @@ commands = - - [testenv:norewrite] - commands = -- pytest test_pytest_mock.py --assert=plain -ra -+ pytest test_pytest_mock.py --assert=plain - - [testenv:linting] - skip_install=True -@@ -23,3 +23,9 @@ deps = - commands = - py.test --flakes pytest_mock.py test_pytest_mock.py -m flakes - rst-lint CHANGELOG.rst README.rst -+ -+[tool:pytest] -+addopts = -r a -+ -+[flake8] -+max-line-length = 88 --- -2.23.0 - diff --git a/backport-tests-handle-new-output-format-with-Python-3.8.patch b/backport-tests-handle-new-output-format-with-Python-3.8.patch deleted file mode 100644 index 0f5efa69de9896e36e7f62776d17468eef39eb27..0000000000000000000000000000000000000000 --- a/backport-tests-handle-new-output-format-with-Python-3.8.patch +++ /dev/null @@ -1,72 +0,0 @@ -From 91ece5ec239e7bf68e928e0377c5335ca5fc214a Mon Sep 17 00:00:00 2001 -From: Daniel Hahler -Date: Sat, 30 Mar 2019 10:58:12 +0100 -Subject: [PATCH] tests: handle new output format with Python 3.8 - -Fixes https://github.com/pytest-dev/pytest-mock/issues/139. ---- - test_pytest_mock.py | 43 +++++++++++++++++++++++++++++-------------- - 1 file changed, 29 insertions(+), 14 deletions(-) - -diff --git a/test_pytest_mock.py b/test_pytest_mock.py -index 1cb3889..2413593 100644 ---- a/test_pytest_mock.py -+++ b/test_pytest_mock.py -@@ -12,6 +12,9 @@ pytest_plugins = 'pytester' - skip_pypy = pytest.mark.skipif(platform.python_implementation() == 'PyPy', - reason='could not make work on pypy') - -+# Python 3.8 changed the output formatting (bpo-35500). -+PY38 = sys.version_info >= (3, 8) -+ - - @pytest.fixture - def needs_assert_rewrite(pytestconfig): -@@ -179,7 +182,11 @@ class TestMockerStub: - - def __test_failure_message(self, mocker, **kwargs): - expected_name = kwargs.get('name') or 'mock' -- expected_message = 'Expected call: {0}()\nNot called'.format(expected_name) -+ if PY38: -+ msg = "expected call not found.\nExpected: {0}()\nActual: not called." -+ else: -+ msg = "Expected call: {0}()\nNot called" -+ expected_message = msg.format(expected_name) - stub = mocker.stub(**kwargs) - with pytest.raises(AssertionError) as exc_info: - stub.assert_called_with() -@@ -559,11 +566,20 @@ def test_detailed_introspection(testdir): - m.assert_called_once_with('', bar=4) - """) - result = testdir.runpytest('-s') -- result.stdout.fnmatch_lines([ -- "*AssertionError: Expected call: mock('', bar=4)*", -- "*Actual call: mock('fo')*", -+ if PY38: -+ expected_lines = [ -+ "*AssertionError: expected call not found.", -+ "*Expected: mock('', bar=4)", -+ "*Actual: mock('fo')", -+ ] -+ else: -+ expected_lines = [ -+ "*AssertionError: Expected call: mock('', bar=4)*", -+ "*Actual call: mock('fo')*", -+ ] -+ expected_lines += [ - "*pytest introspection follows:*", -- '*Args:', -+ "*Args:", - "*assert ('fo',) == ('',)", - "*At index 0 diff: 'fo' != ''*", - "*Use -v to get the full diff*", -@@ -572,7 +588,8 @@ def test_detailed_introspection(testdir): - "*Right contains more items:*", - "*{'bar': 4}*", - "*Use -v to get the full diff*", -- ]) -+ ] -+ result.stdout.fnmatch_lines(expected_lines) - - - def test_assert_called_with_unicode_arguments(mocker): diff --git a/pytest-mock-1.10.0.tar.gz b/pytest-mock-1.10.0.tar.gz deleted file mode 100644 index 9247fa744698d58b6e095e3701622f468ea75b5c..0000000000000000000000000000000000000000 Binary files a/pytest-mock-1.10.0.tar.gz and /dev/null differ diff --git a/pytest-mock-3.6.1.tar.gz b/pytest-mock-3.6.1.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..5b8477d1ccd382fe131c881276b67bb440b97d11 Binary files /dev/null and b/pytest-mock-3.6.1.tar.gz differ diff --git a/pytest-mock-issue272-asyncio.patch b/pytest-mock-issue272-asyncio.patch new file mode 100644 index 0000000000000000000000000000000000000000..b28f9fb3ec1783061adc85df1ec0b88119876a07 --- /dev/null +++ b/pytest-mock-issue272-asyncio.patch @@ -0,0 +1,46 @@ +Index: pytest-mock-3.6.1/tests/test_pytest_mock.py +=================================================================== +--- pytest-mock-3.6.1.orig/tests/test_pytest_mock.py ++++ pytest-mock-3.6.1/tests/test_pytest_mock.py +@@ -839,7 +839,7 @@ def test_plain_stopall(testdir: Any) -> + """ + ) + result = testdir.runpytest_subprocess() +- result.stdout.fnmatch_lines("* 1 passed in *") ++ result.stdout.fnmatch_lines("* 1 passed*") + assert "RuntimeError" not in result.stderr.str() + + +@@ -978,7 +978,7 @@ def test_used_with_class_scope(testdir: + ) + result = testdir.runpytest_subprocess() + assert "AssertionError" not in result.stderr.str() +- result.stdout.fnmatch_lines("* 1 passed in *") ++ result.stdout.fnmatch_lines("* 1 passed*") + + + def test_used_with_module_scope(testdir: Any) -> None: +@@ -1000,7 +1000,7 @@ def test_used_with_module_scope(testdir: + ) + result = testdir.runpytest_subprocess() + assert "AssertionError" not in result.stderr.str() +- result.stdout.fnmatch_lines("* 1 passed in *") ++ result.stdout.fnmatch_lines("* 1 passed*") + + + def test_used_with_package_scope(testdir: Any) -> None: +@@ -1023,7 +1023,7 @@ def test_used_with_package_scope(testdir + ) + result = testdir.runpytest_subprocess() + assert "AssertionError" not in result.stderr.str() +- result.stdout.fnmatch_lines("* 1 passed in *") ++ result.stdout.fnmatch_lines("* 1 passed*") + + + def test_used_with_session_scope(testdir: Any) -> None: +@@ -1046,4 +1046,4 @@ def test_used_with_session_scope(testdir + ) + result = testdir.runpytest_subprocess() + assert "AssertionError" not in result.stderr.str() +- result.stdout.fnmatch_lines("* 1 passed in *") ++ result.stdout.fnmatch_lines("* 1 passed*") diff --git a/python-pytest-mock.spec b/python-pytest-mock.spec index f951eefd452014c792a8ae5922a5af193a3a5772..a4e22c72c59fe01b0c5d023bd669dfa6279b50fd 100644 --- a/python-pytest-mock.spec +++ b/python-pytest-mock.spec @@ -1,12 +1,11 @@ Name: python-pytest-mock -Version: 1.10.0 -Release: 8 +Version: 3.6.1 +Release: 1 Summary: Thin-wrapper around the mock package for easier use with py.test License: MIT URL: https://pypi.python.org/pypi/pytest-mock -Source0: https://files.pythonhosted.org/packages/source/p/pytest-mock/pytest-mock-%{version}.tar.gz -Patch0001: backport-tests-handle-new-output-format-with-Python-3.8.patch -Patch0002: 0001-fix-tests-expectations-with-pytest4.patch +Source0: https://files.pythonhosted.org/packages/b3/08/b131e1b5c628a7d46c9b8d676a86a8d235bced79b9d90845500e39df81b9/pytest-mock-%{version}.tar.gz +Patch0001: pytest-mock-issue272-asyncio.patch BuildArch: noarch %description @@ -18,7 +17,7 @@ it also provides other nice utilities. %package -n python3-pytest-mock Summary: Thin-wrapper around the mock package for easier use with py.test BuildArch: noarch -BuildRequires: python3-devel python3-pytest >= 2.7 python3-setuptools_scm +BuildRequires: python3-devel python3-pytest >= 2.7 python3-setuptools_scm python3-pytest-mock Requires: python3-pytest >= 2.7 %{?python_provide:%python_provide python3-pytest-mock} @@ -41,17 +40,18 @@ rm -rf *.egg-info %check -PYTHONPATH="$(pwd)" py.test-%{python3_version} test_pytest_mock.py +/usr/bin/pytest --assert=plain %files -n python3-pytest-mock %doc README.rst %license LICENSE %{python3_sitelib}/pytest_mock-%{version}-py%{python3_version}.egg-info/ -%{python3_sitelib}/pytest_mock.py* -%{python3_sitelib}/_pytest_mock_version.py* -%{python3_sitelib}/__pycache__/* +%{python3_sitelib}/pytest_mock/ %changelog +* Tue Apr 26 2022 caodongxia - 3.6.1-1 +- update to 3.6.1 + * Mon Jan 11 2021 maminjie - 1.10.0-8 - fix tests expectations with pytest4