From 1afafe43ceba1084b46e4fff2472d7e48525ba34 Mon Sep 17 00:00:00 2001 From: zhanzhimin Date: Sat, 7 Aug 2021 17:39:30 +0800 Subject: [PATCH] fix tests expectations with pytest4 --- ...-fix-tests-expectations-with-pytest4.patch | 50 +++++++++++++++++++ python-pytest-mock.spec | 7 ++- 2 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 backport-fix-tests-expectations-with-pytest4.patch diff --git a/backport-fix-tests-expectations-with-pytest4.patch b/backport-fix-tests-expectations-with-pytest4.patch new file mode 100644 index 0000000..d6d6c1d --- /dev/null +++ b/backport-fix-tests-expectations-with-pytest4.patch @@ -0,0 +1,50 @@ +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/python-pytest-mock.spec b/python-pytest-mock.spec index b6f108a..4341c1a 100644 --- a/python-pytest-mock.spec +++ b/python-pytest-mock.spec @@ -1,12 +1,14 @@ Name: python-pytest-mock Version: 1.10.0 -Release: 4 +Release: 5 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 BuildArch: noarch +Patch6000: backport-fix-tests-expectations-with-pytest4.patch + %description This plugin provides a mocker fixture which is a thin-wrapper around the patching API provided by the mock package. @@ -74,5 +76,8 @@ PYTHONPATH="$(pwd)" py.test-%{python3_version} test_pytest_mock.py %{python3_sitelib}/__pycache__/* %changelog +* Sat Aug 07 2021 zhanzhimin - 1.10.0-5 +- fix tests expectations with pytest4 + * Wed Jan 08 2019 yangjian - 1.10.0-4 - Package init -- Gitee