Blob Blame History Raw
# EPEL is missing dependencies required for docs and tests
%if 0%{?rhel}
%bcond_with docs
%bcond_with tests
%bcond_without docs
%bcond_without tests

%global modname testslide
%global pypi_name TestSlide
%global obs_verrel 2.6.4-99

Name:           python-%{pypi_name}
Version:        2.7.0
Release:        %autorelease
Summary:        A Python test framework

License:        MIT
# The PyPI tarball doesn't include tests, so use the original source instead
Source0:        %{url}/archive/%{version}/%{pypi_name}-%{version}.tar.gz
# testslide: drop deprecated asyncio.coroutines.CoroWrapper for Python 3.11
Patch0:         %{url}/commit/6823054772318a47bbcdd2b35d8f0fd4573e98af.patch
# testslide: fix DeprecationWarning issues with Python 3.11
Patch1:         %{url}/commit/3be202fec12f1ab6fab8b530f7c42e2f29a4c76b.patch
# Set language
Patch2:         %{url}/commit/5d7dcccd071a5cfbd4b0b93b48e86991b9c17d75.patch
BuildArch:      noarch

BuildRequires:  python3-devel

%if %{with docs}
# Docs requirements
BuildRequires:  make
BuildRequires:  /usr/bin/tput

%if %{with tests}
# Test requirements
BuildRequires:  python3dist(pytest)

%global _description %{expand:
A test framework for Python that enable unit testing / TDD / BDD to be
productive and enjoyable.

Its well behaved mocks with thorough API validations catches bugs both
when code is first written or long in the future when it is changed.

The flexibility of using them with existing unittest.TestCase or TestSlide's
own test runner let users get its benefits without requiring refactoring
existing code.}

%description %{_description}

%package -n     python3-%{modname}
Summary:        %{summary}
Provides:       python3-%{pypi_name} = %{version}-%{release}
Obsoletes:      python3-%{pypi_name} < %{obs_verrel}

%description -n python3-%{modname} %{_description}

%if %{with docs}
%package -n     python3-%{modname}-docs
Summary:        Documentation for python3-%{pypi_name}
Provides:       python3-%{pypi_name}-docs = %{version}-%{release}
Obsoletes:      python3-%{pypi_name} < %{obs_verrel}

%description -n python3-%{modname}-docs %{_description}

The python3-%{modname}-docs package contains documentation for

%autosetup -n %{pypi_name}-%{version} -p1
# remove unnecessary test BRs
sed -i '/^mypy/d' requirements-dev.txt
sed -i '/^sphinx-autobuild/d' requirements-dev.txt

%pyproject_buildrequires -r requirements-dev.txt

%if %{with docs}
make docs V=1

%pyproject_save_files %{modname}

%if %{with tests}
%pytest tests/* tests/*

%files -n python3-%{modname} -f %{pyproject_files}
%license LICENSE

%if %{with docs}
%files -n python3-%{modname}-docs
%doc docs/_build/html