Compare commits
10 Commits
2e42cbf0d7
...
843b3a4ec9
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
843b3a4ec9 | ||
|
|
2aaa7557fa | ||
|
|
049e20fbd6 | ||
|
|
a4e477e77b | ||
|
|
aa195dac46 | ||
|
|
0eb07f384d | ||
|
|
0d34590550 | ||
|
|
74980cff4d | ||
|
|
7862874c1f | ||
|
|
c1dd0b29a2 |
@ -1,37 +0,0 @@
|
||||
From ed9daac30fb2a6c9e4f32bdbab6907012d96980d Mon Sep 17 00:00:00 2001
|
||||
From: lizhenhua <lizhenhua@sina.com>
|
||||
Date: Wed, 24 Jun 2020 16:34:29 +0800
|
||||
Subject: [PATCH] modify test cases for python3.8
|
||||
|
||||
---
|
||||
test_pytest_mock.py | 7 ++++---
|
||||
1 file changed, 4 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/test_pytest_mock.py b/test_pytest_mock.py
|
||||
index d9a4faf..1fb2574 100644
|
||||
--- a/test_pytest_mock.py
|
||||
+++ b/test_pytest_mock.py
|
||||
@@ -179,7 +179,7 @@ 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)
|
||||
+ expected_message = 'expected call not found.\nExpected: {0}()\nActual: not called.'.format(expected_name)
|
||||
stub = mocker.stub(**kwargs)
|
||||
with pytest.raises(AssertionError) as exc_info:
|
||||
stub.assert_called_with()
|
||||
@@ -560,8 +560,9 @@ def test_detailed_introspection(testdir):
|
||||
""")
|
||||
result = testdir.runpytest('-s')
|
||||
result.stdout.fnmatch_lines([
|
||||
- "*AssertionError: Expected call: mock('', bar=4)*",
|
||||
- "*Actual call: mock('fo')*",
|
||||
+ "*AssertionError: expected call not found.",
|
||||
+ "*Expected: mock('', bar=4)",
|
||||
+ "*Actual: mock('fo')",
|
||||
"*pytest introspection follows:*",
|
||||
'*Args:',
|
||||
"*assert ('fo',) == ('',)",
|
||||
--
|
||||
2.23.0
|
||||
|
||||
Binary file not shown.
BIN
pytest-mock-3.11.1.tar.gz
Normal file
BIN
pytest-mock-3.11.1.tar.gz
Normal file
Binary file not shown.
61
pytest-mock-issue272-asyncio.patch
Normal file
61
pytest-mock-issue272-asyncio.patch
Normal file
@ -0,0 +1,61 @@
|
||||
From 18f6ba2f7733e0145c87038bed8e1f95b1125e56 Mon Sep 17 00:00:00 2001
|
||||
From: li-miaomiao_zhr <mmlidc@isoftstone.com>
|
||||
Date: Wed, 28 Jun 2023 15:08:15 +0800
|
||||
Subject: [PATCH] pytest mock issue272 asyncio
|
||||
|
||||
---
|
||||
tests/test_pytest_mock.py | 10 +++++-----
|
||||
1 file changed, 5 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/tests/test_pytest_mock.py b/tests/test_pytest_mock.py
|
||||
index 3d53241..5e3ac7b 100644
|
||||
--- a/tests/test_pytest_mock.py
|
||||
+++ b/tests/test_pytest_mock.py
|
||||
@@ -948,7 +948,7 @@ def test_plain_stopall(testdir: Any) -> None:
|
||||
"""
|
||||
)
|
||||
result = testdir.runpytest_subprocess()
|
||||
- result.stdout.fnmatch_lines("* 1 passed in *")
|
||||
+ result.stdout.fnmatch_lines("* 1 passed*")
|
||||
assert "RuntimeError" not in result.stderr.str()
|
||||
|
||||
|
||||
@@ -1093,7 +1093,7 @@ def test_used_with_class_scope(testdir: Any) -> None:
|
||||
)
|
||||
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:
|
||||
@@ -1121,7 +1121,7 @@ def test_used_with_module_scope(testdir: Any) -> None:
|
||||
)
|
||||
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:
|
||||
@@ -1149,7 +1149,7 @@ def test_used_with_package_scope(testdir: Any) -> None:
|
||||
)
|
||||
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:
|
||||
@@ -1177,7 +1177,7 @@ def test_used_with_session_scope(testdir: Any) -> None:
|
||||
)
|
||||
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_stop_patch(mocker):
|
||||
--
|
||||
2.39.1
|
||||
|
||||
@ -1,11 +1,12 @@
|
||||
Name: python-pytest-mock
|
||||
Version: 1.10.0
|
||||
Release: 5
|
||||
Version: 3.11.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
|
||||
Patch0000: 0001-modify-test-cases-for-python3.8.patch
|
||||
Source0: https://files.pythonhosted.org/packages/b3/08/b131e1b5c628a7d46c9b8d676a86a8d235bced79b9d90845500e39df81b9/pytest-mock-%{version}.tar.gz
|
||||
Patch0001: pytest-mock-issue272-asyncio.patch
|
||||
|
||||
BuildArch: noarch
|
||||
|
||||
%description
|
||||
@ -14,23 +15,10 @@ patching API provided by the mock package.
|
||||
Besides undoing the mocking automatically after the end of the test,
|
||||
it also provides other nice utilities.
|
||||
|
||||
%package -n python2-pytest-mock
|
||||
Summary: Thin-wrapper around the mock package for easier use with py.test
|
||||
BuildArch: noarch
|
||||
BuildRequires: python2-devel python2-pytest >= 2.7 python2-mock python2-setuptools_scm
|
||||
Requires: python2-pytest >= 2.7 python2-mock
|
||||
%{?python_provide:%python_provide python2-pytest-mock}
|
||||
|
||||
%description -n python2-pytest-mock
|
||||
This plugin provides a mocker fixture which is a thin-wrapper around the
|
||||
patching API provided by the mock package.
|
||||
Besides undoing the mocking automatically after the end of the test,
|
||||
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}
|
||||
|
||||
@ -45,36 +33,44 @@ it also provides other nice utilities.
|
||||
rm -rf *.egg-info
|
||||
|
||||
%build
|
||||
%py2_build
|
||||
%py3_build
|
||||
|
||||
|
||||
%install
|
||||
%py3_install
|
||||
%py2_install
|
||||
|
||||
|
||||
%check
|
||||
PYTHONPATH="$(pwd)" py.test-%{python2_version} test_pytest_mock.py
|
||||
PYTHONPATH="$(pwd)" py.test-%{python3_version} test_pytest_mock.py
|
||||
|
||||
%files -n python2-pytest-mock
|
||||
%doc README.rst
|
||||
%license LICENSE
|
||||
%{python2_sitelib}/pytest_mock-%{version}-py%{python2_version}.egg-info/
|
||||
%{python2_sitelib}/pytest_mock.py*
|
||||
%{python2_sitelib}/_pytest_mock_version.py*
|
||||
|
||||
CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}" \
|
||||
PATH="%{buildroot}%{_bindir}:$PATH" \
|
||||
PYTHONPATH="${PYTHONPATH:-%{buildroot}%{python3_sitearch}:%{buildroot}%{python3_sitelib}}" \
|
||||
PYTHONDONTWRITEBYTECODE=1 \
|
||||
%{?__pytest_addopts:PYTEST_ADDOPTS="${PYTEST_ADDOPTS:-} %{__pytest_addopts}"} \
|
||||
PYTEST_XDIST_AUTO_NUM_WORKERS=%{_smp_build_ncpus} \
|
||||
%{_bindir}/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
|
||||
* Wed Jun 28 2023 li-miaomiao_zhr <mmlidc@isoftstone.com> - 3.11.1-1
|
||||
- Update to 3.11.1
|
||||
|
||||
* Tue Apr 26 2022 caodongxia <caodongxia@h-partners.com> - 3.6.1-1
|
||||
- update to 3.6.1
|
||||
|
||||
* Mon Jan 11 2021 maminjie <maminje1@huawei.com> - 1.10.0-8
|
||||
- fix tests expectations with pytest4
|
||||
|
||||
* Tue Aug 11 2020 lingsheng <lingsheng@huawei.com> - 1.10.0-7
|
||||
- Remove python2-pytest-mock subpackage
|
||||
|
||||
* Sun Jun 28 2020 lingsheng <lingsheng@huawei.com> - 1.10.0-6
|
||||
- Tests handle new output format with Python 3.8
|
||||
|
||||
* Wed Jun 24 2020 lizhenhua <lizhenhua21@huawei.com> - 1.10.0-5
|
||||
- Modify test cases for python3.8
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user