Blob Blame History Raw
%if 0%{?el9}
# Needs pytest-xdist and typing-extensions which pull in a bunch of BRs, see
# missing-epel9-test-brs.json
%bcond_with tests
%bcond_with doc
%bcond_without tests
%bcond_without doc

Name:           python-hypothesis
Version:        6.39.1
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
# extras with missing deps:
#  codemods: libcst
#  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

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

%if %{with tests}
k="not test_registered_from_entrypoint"

k="$k and not test_recursion_error_is_not_flaky"

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

%pytest -v -n auto -k "$k" \
  --ignore tests/codemods \
  --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}