Blob Blame History Raw
# requires sphinx_kr_theme which isn't packaged yet
%bcond_with docs

# "_validate_return_type: passes for valid forward reference" fails
%bcond_with tests

# Enable Python dependency generation
%{?python_enable_dependency_generator}

# Created by pyp2rpm-3.3.4
%global pypi_name TestSlide

Name:           python-%{pypi_name}
Version:        2.6.1
Release:        2%{?dist}
Summary:        A Python test framework

License:        MIT
URL:            https://github.com/facebookincubator/TestSlide
# The PyPI tarball doesn't include tests, so use the original source instead
Source0:        https://github.com/facebookincubator/TestSlide/archive/%{version}.tar.gz#/%{pypi_name}-%{version}.tar.gz
BuildArch:      noarch

BuildRequires:  python3-devel
BuildRequires:  python3dist(setuptools) >= 38.6
BuildRequires:  sed

%if %{with docs}
# Docs requirements
BuildRequires:  make
BuildRequires:  ncurses
BuildRequires:  python3dist(sphinx)
# Not available yet
# BuildRequires: python3dist(sphinx_kr_theme)
%endif

%if %{with tests}
# Test requirements
BuildRequires:  make
BuildRequires:  python3dist(coverage)
BuildRequires:  python3dist(psutil)
BuildRequires:  python3dist(pygments)
BuildRequires:  python3dist(typeguard)
%endif

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

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

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


%prep
%autosetup -n %{pypi_name}-%{version}
# Remove bundled egg-info
rm -rf %{pypi_name}.egg-info

# Remove unneeded shebang
sed -e "\|#!/usr/bin/env python3|d" -i testslide/*.py

%build
%py3_build
%if %{with docs}
make docs
%endif

%install
%py3_install

%if %{with tests}
%check
export PYTHONPATH=%{buildroot}%{python3_sitelib}
make tests V=1
%endif

%files -n python3-%{pypi_name}
%license LICENSE
%doc README.md
%{_bindir}/testslide
%{python3_sitelib}/testslide
%{python3_sitelib}/%{pypi_name}-%{version}-py%{python3_version}.egg-info

%changelog
* Tue Oct 27 2020 Davide Cavalca <dcavalca@fb.com> - 2.6.1-2
- Update BuildRequires
- Remove unneeded shebangs
- Drop unnecessary python_provide macro

* Tue Oct 27 2020 Davide Cavalca <dcavalca@fb.com> - 2.6.1-1
- Initial package
- Disable tests and docs for now