Blob Blame History Raw
%if 0%{?rhel} >= 9
# Needs pytest-xdist and typing-extensions which pull in a bunch of BRs, see
# missing-epel9-test-brs.json
# Later RHEL versions are also expected to be missing some or all of these
%bcond_with tests
%bcond_with doc
%bcond_without tests
%bcond_without doc

Name:           python-hypothesis
Version:        6.82.0
Release:        %autorelease
Summary:        Library for property based testing

License:        MPLv2.0
Source0:        %{url}/archive/hypothesis-python-%{version}/hypothesis-%{version}.tar.gz

BuildArch:      noarch

BuildRequires:  python%{python3_pkgversion}-devel
BuildRequires:  pyproject-rpm-macros >= 0-43

%if %{with tests}
# optional test dependencies:
BuildRequires:  %{py3_dist typing_extensions}

%if %{with doc}
BuildRequires:  %{_bindir}/sphinx-build
BuildRequires:  %{py3_dist sphinx-hoverxref}
BuildRequires:  %{py3_dist sphinx-rtd-theme}
BuildRequires:  %{py3_dist sphinx_selective_exclude}

%global _description %{expand:
Hypothesis is a library for testing your Python code against a much
larger range of examples than you would ever want to write by
hand. It’s based on the Haskell library, Quickcheck, and is designed
to integrate seamlessly into your existing Python unit testing work

%description %{_description}

%package     -n python%{python3_pkgversion}-hypothesis
Summary:        %{summary}

%description -n python%{python3_pkgversion}-hypothesis %{_description}

%global extras cli,ghostwriter,pytz,dateutil,lark,numpy,pandas,pytest,redis,zoneinfo,django,codemods
# extras with missing deps:
#  dpcontracts: dpcontracts
%{pyproject_extras_subpkg -n python%{python3_pkgversion}-hypothesis %{extras}}

%autosetup -n hypothesis-hypothesis-python-%{version}/hypothesis-python -p2
# disable Sphinx extensions that require Internet access
sed -i -e '/sphinx.ext.intersphinx/d' docs/
# disable Sphinx non-available extensions
sed -i -e '/sphinx_codeautolink/d' docs/

%pyproject_buildrequires %{?with_tests:../requirements/ -x %{extras}}


%if %{with doc}
PYTHONPATH=src READTHEDOCS=True sphinx-build -b man docs docs/_build/man

%pyproject_save_files hypothesis '_hypothesis_*'

%if %{with doc}
install -Dpm0644 -t %{buildroot}%{_mandir}/man1 docs/_build/man/hypothesis.1

%if %{with tests}
k="not test_registered_from_entrypoint and not test_make_full_patch[covering]"

%if "%{_arch}" == "s390x"
k="$k and not test_data_frames_with_timestamp_columns"

%pytest -v -n auto -k "$k" \
  --ignore tests/dpcontracts \
  --ignore tests/redis \

# The BRP that handles bytecompilation already run at the end of %%install.
# This autogenerated file gets re-generated during tests,
# the tests asserts the content is identical, but the mtime is changed anyway.
# Since %%pytest disables byte-compilation, we need to update the pycs manually:
%py_byte_compile %{python3} %{buildroot}%{python3_sitelib}/hypothesis/internal/conjecture/shrinking/

%files -n python%{python3_pkgversion}-hypothesis -f %{pyproject_files}
%license ../LICENSE.txt
%doc README.rst
%if %{with doc}