Blob Blame History Raw
%global srcname pytest-regressions

Name:           python-%{srcname}
Version:        2.2.0
Release:        1%{?dist}
Summary:        Pytest fixtures for writing regression tests
License:        MIT
URL:            https://pytest-regressions.readthedocs.io/
Source0:        https://github.com/ESSS/%{srcname}/archive/%{version}/%{srcname}-%{version}.tar.gz
# The code uses deprecated numpy types (np.bool, np.float, and np.int).  Numpy
# raises DeprecationWarnings, which cause tests to fail.  Use bool, float, and
# int instead.
# https://github.com/ESSS/pytest-regressions/commit/ffad2c7fd1d110f420f4e3ca3d39d90cae18a972
Patch0:         %{name}-numpy.patch

BuildArch:      noarch

BuildRequires:  make
BuildRequires:  pyproject-rpm-macros
BuildRequires:  python3-devel
BuildRequires:  %{py3_dist matplotlib}
BuildRequires:  %{py3_dist numpy}
BuildRequires:  %{py3_dist pandas}
BuildRequires:  %{py3_dist pillow}
BuildRequires:  %{py3_dist pytest}
BuildRequires:  %{py3_dist pytest-datadir}
BuildRequires:  %{py3_dist pyyaml}
BuildRequires:  %{py3_dist restructuredtext-lint}
BuildRequires:  %{py3_dist setuptools}
BuildRequires:  %{py3_dist sphinx}
BuildRequires:  %{py3_dist sphinx_rtd_theme}
BuildRequires:  %{py3_dist tox}
BuildRequires:  %{py3_dist tox-current-env}

%global _desc %{expand:
This pytest plugin makes it simple to test general data, images, files,
and numeric tables by saving *expected* data in a *data directory*
(courtesy of pytest-datadir) that can be used to verify that future runs
produce the same data.}

%description %_desc

%package     -n python3-%{srcname}
Summary:        %{summary}

%description -n python3-%{srcname} %_desc

%package        doc
Summary:        Documentation for %{name}

%description    doc
Documentation for %{name}.

%prep
%autosetup -n %{srcname}-%{version} -p1

# Do not attempt to use git to determine the version
sed -i "s/use_scm_version.*/version='%{version}',/;/setuptools_scm/d" setup.py
sed -e 's/\(version = \).*/\1"%{version}"/' \
    -e 's/\(release = \).*/\1"%{version}"/' \
    -i doc/conf.py

%build
%py3_build

# Build documentation
PYTHONPATH=$PWD/build/lib make -C doc html
rst2html --no-datestamp CHANGELOG.rst CHANGELOG.html
rst2html --no-datestamp README.rst README.html
rm doc/_build/html/.buildinfo

%install
%py3_install

%check
%tox

%files       -n python3-%{srcname}
%doc CHANGELOG.html README.html
%license LICENSE
%{python3_sitelib}/pytest_regressions*

%files          doc
%doc doc/_build/html

%changelog
* Tue Jul 13 2021 Jerry James <loganjerry@gmail.com> - 2.2.0-1
- Initial RPM