%define name python3-mock
%define srcname mock
%define version 3.0.5
%define release 1

%{!?dotests: %define dotests 1}

%define is_python %(test -e /opt/freeware/bin/python3_32 && echo 1 || echo 0)
%if %{is_python}
%define python_sitelib %(python3_32 -c "from distutils.sysconfig import get_python_lib; print (get_python_lib(1))")
%endif

%define _libdir64 %{_prefix}/lib64

%define is_python_64 %(test -e /usr/bin/python3_64 && echo 1 || echo 0)
%if %{is_python_64}
%define python_sitelib64 %(python3 -c "from distutils.sysconfig import get_python_lib; print (get_python_lib(1))")
%endif

Summary: A Python Mocking and Patching Library for Testing
Name: %{name}
Version: %{version}
Release: %{release}
Source0: %{srcname}-%{version}.tar.gz
License: UNKNOWN
Group: Development/Libraries
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
Prefix: %{_prefix}
BuildArch: noarch
Vendor: Michael Foord <michael@voidspace.org.uk>
Url: http://www.voidspace.org.uk/python/mock/

BuildRequires: python3 >= 3.7.4
BuildRequires: python3-devel >= 3.7.4
Requires: python3 >= 3.7.4, python3-six >= 1.13.0

%description
mock is a library for testing in Python. It allows you to replace parts of
your system under test with mock objects and make assertions about how they
have been used.

mock is now part of the Python standard library, available as `unittest.mock
<http://docs.python.org/py3k/library/unittest.mock.html#module-unittest.mock>`_
in Python 3.3 onwards.

mock provides a core `MagicMock` class removing the need to create a host of
stubs throughout your test suite. After performing an action, you can make
assertions about which methods / attributes were used and arguments they were
called with. You can also specify return values and set needed attributes in
the normal way.

%prep
%setup -n %{srcname}-%{version}

%build
python3 setup.py build
if [ "%{dotests}" == 1 ]
then
           (python3 setup.py test || true)
fi

%install
[ -d "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT

python3 setup.py install --skip-build --root ${RPM_BUILD_ROOT}

%clean
[ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT}

%files
%defattr(-,root,system,-)
%doc LICENSE.txt PKG-INFO README.rst CHANGELOG.rst
#%doc docs
%{python_sitelib}/mock*

%changelog
* Mon Jan 13 2020 Ashwini Chandrappa <ashwic22@in.ibm.com> - 3.0.5-1
-Build with python3 and updated to latest version
 
* Thu Jun 7 2013 Tristan Delhalle <Tristan.Delhalle@ext.bull.net> - 1.0.1-1
- first version for AIX V6.1 and higher

