d805ab8
# EPEL is missing dependencies required for docs and tests
d805ab8
%if 0%{?rhel}
d805ab8
%bcond_with docs
d805ab8
%bcond_with tests
d805ab8
%else
f1fb246
%bcond_without docs
f1fb246
%bcond_without tests
d805ab8
%endif
0ac3050
7f3720d
%global modname testslide
0ac3050
%global pypi_name TestSlide
7f3720d
%global obs_verrel 2.6.4-99
0ac3050
0ac3050
Name:           python-%{pypi_name}
cf7244d
Version:        2.7.1
0c2b639
Release:        %autorelease
0ac3050
Summary:        A Python test framework
0ac3050
0ac3050
License:        MIT
9184b23
URL:            https://github.com/facebook/TestSlide
0ac3050
# The PyPI tarball doesn't include tests, so use the original source instead
b93efa7
Source0:        %{url}/archive/%{version}/%{pypi_name}-%{version}.tar.gz
2dfe9b5
# Updating Testslide to typeguard 3.02
2dfe9b5
# https://github.com/facebook/TestSlide/pull/352
2dfe9b5
#
2dfe9b5
# Rebased to 2.7.1; version bound loosened to allow 4.x as well as 3.x
2dfe9b5
Patch0:         TestSlide-2.7.1-typeguard-4.patch
0ac3050
BuildArch:      noarch
0ac3050
0ac3050
BuildRequires:  python3-devel
0ac3050
0ac3050
%if %{with docs}
0ac3050
# Docs requirements
0ac3050
BuildRequires:  make
24c4c04
BuildRequires:  /usr/bin/tput
cc89ddf
BuildRequires:  python3-ipython-sphinx
0ac3050
%endif
0ac3050
0ac3050
%if %{with tests}
0ac3050
# Test requirements
7f3720d
BuildRequires:  python3dist(pytest)
0ac3050
%endif
0ac3050
7f3720d
%global _description %{expand:
0ac3050
A test framework for Python that enable unit testing / TDD / BDD to be
0ac3050
productive and enjoyable.
0ac3050
0ac3050
Its well behaved mocks with thorough API validations catches bugs both
0ac3050
when code is first written or long in the future when it is changed.
0ac3050
0ac3050
The flexibility of using them with existing unittest.TestCase or TestSlide's
0ac3050
own test runner let users get its benefits without requiring refactoring
7f3720d
existing code.}
0ac3050
7f3720d
%description %{_description}
0ac3050
0ac3050
7f3720d
%package -n     python3-%{modname}
7f3720d
Summary:        %{summary}
7f3720d
Provides:       python3-%{pypi_name} = %{version}-%{release}
7f3720d
Obsoletes:      python3-%{pypi_name} < %{obs_verrel}
7f3720d
7f3720d
%description -n python3-%{modname} %{_description}
0ac3050
0ac3050
f1fb246
%if %{with docs}
7f3720d
%package -n     python3-%{modname}-docs
f1fb246
Summary:        Documentation for python3-%{pypi_name}
7f3720d
Provides:       python3-%{pypi_name}-docs = %{version}-%{release}
7f3720d
Obsoletes:      python3-%{pypi_name} < %{obs_verrel}
7f3720d
7f3720d
%description -n python3-%{modname}-docs %{_description}
f1fb246
7f3720d
The python3-%{modname}-docs package contains documentation for
7f3720d
python3-%{modname}.
f1fb246
%endif
0ac3050
7f3720d
0ac3050
%prep
b93efa7
%autosetup -n %{pypi_name}-%{version} -p1
7f3720d
# remove unnecessary test BRs
ec47868
sed -r -i '/^(black|coverage|coveralls|flake8|isort|mypy|twine)/d' \
ec47868
    requirements-dev.txt
ec47868
sed -r -i 's/^([[:blank:]]*)("COVERAGE_PROCESS_START")/\1# \2/' \
ec47868
    tests/cli_unittest.py
7f3720d
sed -i '/^sphinx-autobuild/d' requirements-dev.txt
7f3720d
7f3720d
%generate_buildrequires
7f3720d
%pyproject_buildrequires -r requirements-dev.txt
7f3720d
0ac3050
0ac3050
%build
7f3720d
%pyproject_wheel
0ac3050
%if %{with docs}
f1fb246
make docs V=1
0ac3050
%endif
0ac3050
0ac3050
%install
7f3720d
%pyproject_install
7f3720d
%pyproject_save_files %{modname}
7f3720d
0ac3050
0ac3050
%if %{with tests}
0ac3050
%check
7f3720d
%pytest tests/*_unittest.py tests/*_testslide.py
0ac3050
%endif
0ac3050
7f3720d
7f3720d
%files -n python3-%{modname} -f %{pyproject_files}
0ac3050
%license LICENSE
0ac3050
%doc README.md
0ac3050
%{_bindir}/testslide
0ac3050
f1fb246
%if %{with docs}
7f3720d
%files -n python3-%{modname}-docs
f1fb246
%doc docs/_build/html
f1fb246
%endif
f1fb246
7f3720d
0ac3050
%changelog
0c2b639
%autochangelog