Name:           python-pytest-mock
Version:        3.15.1
Release:        2
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:      pytest-mock-issue272-asyncio.patch

BuildArch:      noarch

%description
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 python3-pytest-mock
BuildRequires:  python3-pip python3-wheel python3-pytest-asyncio
Requires:       python3-pytest >= 2.7
%{?python_provide:%python_provide python3-pytest-mock}

%description -n python3-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.

%prep
%autosetup -n pytest_mock-%{version} -p1
rm -rf *.egg-info
sed -i 's/\r$//' README.rst

%build
%pyproject_build

%install
%pyproject_install

%check
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}.dist-info
%{python3_sitelib}/pytest_mock/

%changelog
* Sat Jul 18 2026 Funda Wang <fundawang@yeah.net> - 3.15.1-2
- add missing buildrequires on pytest-asyncio

* Mon Sep 29 2025 lifeifei <lifeifei@kylinos.cn> - 3.15.1-1
- update package to 3.15.1
  * Python 3.8 (EOL) is no longer supported.
  * Added ''spy_return_iter'' to ''mocker.spy''.
  * Fixed ''itertools._tee object has no attribute error''.

* Tue Aug 05 2025 yaoxin <1024769339@qq.com> - 3.14.1-1
- Update to 3.14.1:
  * Add support for Python 3.14

* Sun Sep 29 2024 yaoxin <yao_xin001@hoperun.com> - 3.14.0-1
- Update to 3.14.0:
  * #415: MockType and AsyncMockType can be imported from
    pytest_mock for type annotation purposes.
  * #420: Fixed a regression which would cause
    mocker.patch.object to not being properly cleared between
    tests.
  * #417: spy now has spy_return_list, which is a list containing
    all the values returned by the spied function.
  * pytest-mock now requires pytest>=6.2.5.
  * #410: pytest-mock's setup.py file is removed. If you relied
    on this file, e.g. to install pytest using setup.py install,
    please see Why you shouldn't invoke setup.py directly for
    alternatives.
  * Added support for Python 3.12.
  * Dropped support for EOL Python 3.7.
  * ``mocker.resetall()`` now also resets mocks created by
    ``mocker.create_autospec`` (`#390`_).

* 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

* Wed Jan 08 2019 yangjian<yangjian79@huawei.com> - 1.10.0-4
- Package init