163b66d
%if 0%{?el9}
c69f67f
# Needs pytest-xdist and typing-extensions which pull in a bunch of BRs, see
c69f67f
# missing-epel9-test-brs.json
163b66d
%bcond_with tests
163b66d
%bcond_with doc
163b66d
%else
163b66d
%bcond_without tests
163b66d
%bcond_without doc
163b66d
%endif
163b66d
8aaf74c
Name:           python-hypothesis
73f4e11
Version:        6.45.0
6e858d6
Release:        %autorelease
584fbb6
Summary:        Library for property based testing
d38d6a4
d38d6a4
License:        MPLv2.0
a7ad9a7
URL:            https://github.com/HypothesisWorks/hypothesis
8aaf74c
Source0:        %{url}/archive/hypothesis-python-%{version}/hypothesis-%{version}.tar.gz
d38d6a4
d38d6a4
BuildArch:      noarch
f073ccd
8aaf74c
BuildRequires:  python%{python3_pkgversion}-devel
feb7699
BuildRequires:  pyproject-rpm-macros >= 0-43
8aaf74c
8aaf74c
%if %{with tests}
fad29d1
# optional test dependencies:
fad29d1
BuildRequires:  %{py3_dist typing_extensions}
8aaf74c
%endif
fad29d1
ec82102
%if %{with doc}
ec82102
BuildRequires:  %{_bindir}/sphinx-build
7f22d3b
BuildRequires:  %{py3_dist sphinx-hoverxref}
7f22d3b
BuildRequires:  %{py3_dist sphinx-rtd-theme}
7f22d3b
BuildRequires:  %{py3_dist sphinx_selective_exclude}
ec82102
%endif
c8af0a6
8aaf74c
7f22d3b
%global _description %{expand:
7f22d3b
Hypothesis is a library for testing your Python code against a much
7f22d3b
larger range of examples than you would ever want to write by
7f22d3b
hand. It’s based on the Haskell library, Quickcheck, and is designed
7f22d3b
to integrate seamlessly into your existing Python unit testing work
7f22d3b
flow.}
d445d31
d6de9d4
%description %{_description}
d6de9d4
8aaf74c
8aaf74c
%package     -n python%{python3_pkgversion}-hypothesis
584fbb6
Summary:        %{summary}
d38d6a4
8aaf74c
%description -n python%{python3_pkgversion}-hypothesis %{_description}
8aaf74c
8aaf74c
c85e6a1
%global extras cli,ghostwriter,pytz,dateutil,lark,numpy,pandas,pytest,redis,zoneinfo,django
df25d48
# extras with missing deps:
8aaf74c
#  codemods: libcst
8aaf74c
#  dpcontracts: dpcontracts
8aaf74c
%{pyproject_extras_subpkg -n python%{python3_pkgversion}-hypothesis %{extras}}
8aaf74c
df25d48
d38d6a4
%prep
8aaf74c
%autosetup -n hypothesis-hypothesis-python-%{version}/hypothesis-python -p2
9c3f9f4
# disable Sphinx extensions that require Internet access
9c3f9f4
sed -i -e '/sphinx.ext.intersphinx/d' docs/conf.py
d967ec5
# disable Sphinx non-available extensions
d967ec5
sed -i -e '/sphinx_codeautolink/d' docs/conf.py
d445d31
8aaf74c
8aaf74c
%generate_buildrequires
feb7699
%pyproject_buildrequires %{?with_tests:../requirements/test.in -x %{extras}}
8aaf74c
c8af0a6
d38d6a4
%build
8aaf74c
%pyproject_wheel
8aaf74c
ec82102
%if %{with doc}
fbdb3cd
PYTHONPATH=src READTHEDOCS=True sphinx-build -b man docs docs/_build/man
ec82102
%endif
f073ccd
8aaf74c
d38d6a4
%install
8aaf74c
%pyproject_install
8aaf74c
%pyproject_save_files hypothesis
8aaf74c
ec82102
%if %{with doc}
8aaf74c
install -Dpm0644 -t %{buildroot}%{_mandir}/man1 docs/_build/man/hypothesis.1
ec82102
%endif
d38d6a4
8aaf74c
c8af0a6
%if %{with tests}
c8af0a6
%check
6570743
k="not test_registered_from_entrypoint"
6570743
6570743
# https://github.com/HypothesisWorks/hypothesis/issues/3035
6570743
k="$k and not test_recursion_error_is_not_flaky"
6570743
6570743
# https://github.com/pandas-dev/pandas/commit/95a86a9884e
6570743
%if "%{_arch}" == "s390x"
6570743
k="$k and not test_data_frames_with_timestamp_columns"
4d952df
%endif
6570743
6570743
%pytest -v -n auto -k "$k" \
a7ad9a7
  --ignore tests/codemods \
8aaf74c
  --ignore tests/dpcontracts \
8aaf74c
  --ignore tests/redis \
3c2d080
3c2d080
# The BRP that handles bytecompilation already run at the end of %%install.
3c2d080
# This autogenerated file gets re-generated during tests,
3c2d080
# the tests asserts the content is identical, but the mtime is changed anyway.
3c2d080
# Since %%pytest disables byte-compilation, we need to update the pycs manually:
3c2d080
%py_byte_compile %{python3} %{buildroot}%{python3_sitelib}/hypothesis/internal/conjecture/shrinking/learned_dfas.py
c8af0a6
%endif
c8af0a6
8aaf74c
8aaf74c
%files -n python%{python3_pkgversion}-hypothesis -f %{pyproject_files}
cbd22f3
%license ../LICENSE.txt
d445d31
%doc README.rst
163b66d
%{python3_sitelib}/_hypothesis_pytestplugin.py
163b66d
%{python3_sitelib}/__pycache__/_hypothesis_pytestplugin*.pyc
8710abd
%{_bindir}/hypothesis
ec82102
%if %{with doc}
d445d31
%{_mandir}/man1/hypothesis.1*
ec82102
%endif
f073ccd
8aaf74c
d38d6a4
%changelog
6e858d6
%autochangelog