## START: Set by rpmautospec
## (rpmautospec version 0.3.1)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = 2;
    base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
    print(release_number + base_release_number - 1);
}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}
## END: Set by rpmautospec

%if 0%{?rhel}
# 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
%else
%bcond_without tests
%bcond_without doc
%endif

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

License:        MPLv2.0
URL:            https://github.com/HypothesisWorks/hypothesis
Source0:        %{url}/archive/hypothesis-python-%{version}/hypothesis-%{version}.tar.gz

Patch0:         hypothesis-remove-exceptiongroup.patch

BuildArch:      noarch

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

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

%if 0%{?rhel} < 9
BuildRequires:  python%{python3_pkgversion}-sortedcontainers
BuildRequires:  python%{python3_pkgversion}-attrs
BuildRequires:  python%{python3_pkgversion}-packaging
BuildRequires:  python%{python3_pkgversion}-pip
BuildRequires:  python%{python3_pkgversion}-setuptools
BuildRequires:  python%{python3_pkgversion}-wheel
%endif

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


%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
flow.}

%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}}


%prep
%autosetup -n hypothesis-hypothesis-python-%{version}/hypothesis-python -p2
# disable Sphinx extensions that require Internet access
sed -i -e '/sphinx.ext.intersphinx/d' docs/conf.py
# disable Sphinx non-available extensions
sed -i -e '/sphinx_codeautolink/d' docs/conf.py
# use Fedora-packaged lark-parser until the package is renamed to lark
# the comment near this dependency says:
#   "probably still works with old `lark-parser` too"
sed -i -e 's/"lark>=0.10.1"/"lark-parser>=0.9"/' setup.py

%if 0%{?rhel} > 8
%generate_buildrequires
%pyproject_buildrequires %{?with_tests:../requirements/test.in -x %{extras}}
%endif

%build
%pyproject_wheel

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


%install
%pyproject_install
%pyproject_save_files hypothesis '_hypothesis_*'

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


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

# https://github.com/pandas-dev/pandas/commit/95a86a9884e
%if "%{_arch}" == "s390x"
k="$k and not test_data_frames_with_timestamp_columns"
%endif

%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/learned_dfas.py
%endif


%files -n python%{python3_pkgversion}-hypothesis -f %{pyproject_files}
%license ../LICENSE.txt
%doc README.rst
%{_bindir}/hypothesis
%if %{with doc}
%{_mandir}/man1/hypothesis.1*
%endif


%changelog
* Fri Jan 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 6.62.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild

* Tue Jan 17 2023 Miro Hrončok <miro@hroncok.cz> - 6.62.1-1
- Update to 6.62.1
- Fixes: rhbz#2138440

* Mon Oct 24 2022 Miro Hrončok <miro@hroncok.cz> - 6.56.3-1
- Update to 6.56.3

* Mon Oct 24 2022 Miro Hrončok <miro@hroncok.cz> - 6.49.1-3
- Don't skip a fixed test

* Mon Oct 24 2022 Miro Hrončok <miro@hroncok.cz> - 6.49.1-2
- Add the codemods extra package, libcst is now available

* Mon Oct 24 2022 Miro Hrončok <miro@hroncok.cz> - 6.49.1-1
- Update to 6.49.1

* Fri Jul 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 6.45.0-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild

* Wed Jul 13 2022 Miro Hrončok <miro@hroncok.cz> - 6.45.0-6
- Backport a fix for Python 3.11.0b4

* Thu Jul 07 2022 Miro Hrončok <miro@hroncok.cz> - 6.45.0-5
- Skip one hanging test

* Thu Jul 07 2022 Miro Hrončok <miro@hroncok.cz> - 6.45.0-4
- Python 3.11 fixes

* Fri Jun 17 2022 Python Maint <python-maint@redhat.com> - 6.45.0-3
- Rebuilt for Python 3.11

* Mon Jun 13 2022 Python Maint <python-maint@redhat.com> - 6.45.0-2
- Bootstrap for Python 3.11

* Tue Apr 26 2022 Lumir Balhar <lbalhar@redhat.com> - 6.45.0-1
- Update to 6.45.0

* Thu Mar 03 2022 Miro Hrončok <miro@hroncok.cz> - 6.39.1-1
- Update to 6.39.1, fix regression in @proxies

* Wed Mar 02 2022 Michel Alexandre Salim <salimma@fedoraproject.org> - 6.39.0-1
- Update to 6.39.0 (resolves: rhbz#2048882)

* Fri Jan 21 2022 Michel Alexandre Salim <salimma@fedoraproject.org> - 6.36.0-1
- Update to 6.36.0 (resolves: rhbz#2022978)

* Fri Jan 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 6.24.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild

* Fri Nov 12 2021 Lumír Balhar <lbalhar@redhat.com> - 6.24.2-1
- Update to 6.24.2
Resolves: rhbz#1986184

* Mon Jul 19 2021 Miro Hrončok <mhroncok@redhat.com> - 6.14.3-1
- Update to 6.14.3
- Fixes: rhbz#1937016
- Fixes: rhbz#1902285

* Fri Jun 04 2021 Python Maint <python-maint@redhat.com> - 6.6.0-4
- Rebuilt for Python 3.10

* Wed Jun 02 2021 Python Maint <python-maint@redhat.com> - 6.6.0-3
- Bootstrap for Python 3.10

* Thu Mar 11 2021 Miro Hrončok <mhroncok@redhat.com> - 6.6.0-2
- Skip test_data_frames_with_timestamp_columns on s390x until Pandas is fixed

* Mon Mar 08 2021 Miro Hrončok <mhroncok@redhat.com> - 6.6.0-1
- Update to 6.6.0
- Add subpackages with extras
- Fix python-bytecode-inconsistent-mtime of learned_dfas.py
- Fixes: rhbz#1902400

* Mon Feb 01 2021 Miro Hrončok <mhroncok@redhat.com> - 5.43.9-1
- Update to 5.43.9

* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 5.41.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild

* Sun Nov 22 2020 Michel Alexandre Salim <salimma@fedoraproject.org> - 5.41.3-1
- Update to 5.41.3
- Use py3_dist macro
- Disable Redis tests (missing dependency)
- Enable lark-parser tests

* Fri Nov 13 2020 Miro Hrončok <mhroncok@redhat.com> - 5.29.4-2
- Remove build dependencies on mock and coverage

* Fri Aug 28 2020 Michel Alexandre Salim <salimma@fedoraproject.org> - 5.29.4-1
- Update to 5.29.4

* Fri Aug 28 2020 Michel Alexandre Salim <salimma@fedoraproject.org> - 5.29.3-1
- Update to 5.29.3

* Tue Aug 25 2020 Michel Alexandre Salim <salimma@fedoraproject.org> - 5.29.0-1
- Update to 5.29.0

* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 5.20.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild

* Tue Jul 21 2020 Michel Alexandre Salim <salimma@fedoraproject.org> - 5.20.3-1
- Update to 5.20.3

* Tue May 26 2020 Miro Hrončok <mhroncok@redhat.com> - 5.15.1-3
- Rebuilt for Python 3.9

* Fri May 22 2020 Miro Hrončok <mhroncok@redhat.com> - 5.15.1-2
- Bootstrap for Python 3.9

* Thu May 21 2020 Michel Alexandre Salim <salimma@fedoraproject.org> - 5.15.1-1
- Update to 5.15.1
- Upstream now verifies against Python 3.9 pre-releases in CI

* Sat May 16 2020 Michel Alexandre Salim <salimma@fedoraproject.org> - 5.14.0-1
- Update to 5.14.0

* Wed May 13 2020 Michel Alexandre Salim <salimma@fedoraproject.org> - 5.13.1-1
- Update to 5.13.1
- Python 3.9 fix now upstreamed

* Tue May 12 2020 Michel Alexandre Salim <salimma@fedoraproject.org> - 5.13.0-1
- Update to 5.13.0
- Fix NamedTuple detection on Python 3.9

* Mon May 11 2020 Michel Alexandre Salim <salimma@fedoraproject.org> - 5.12.0-1
- Update to 5.12.0

* Wed May  6 2020 Michel Alexandre Salim <salimma@fedoraproject.org> - 5.10.5-1
- Update to 5.10.5

* Sat Apr 25 2020 Michel Alexandre Salim <salimma@fedoraproject.org> - 5.10.4-1
- Update to 5.10.4

* Wed Apr 22 2020 Michel Alexandre Salim <salimma@fedoraproject.org> - 5.10.3-1
- Update to 5.10.3

* Sun Apr 12 2020 Michel Alexandre Salim <salimma@fedoraproject.org> - 5.8.2-1
- Update to 5.8.2

* Tue Apr  7 2020 Michel Alexandre Salim <salimma@fedoraproject.org> - 5.8.0-2
- Manually add requirement on sortedcontainers

* Tue Apr  7 2020 Michel Alexandre Salim <salimma@fedoraproject.org> - 5.8.0-1
- Update to 5.8.0

* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 4.23.8-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild

* Mon Nov 11 2019 Miro Hrončok <mhroncok@redhat.com> - 4.23.8-6
- Drop python2-hypothesis

* Thu Oct 03 2019 Miro Hrončok <mhroncok@redhat.com> - 4.23.8-5
- Rebuilt for Python 3.8.0rc1 (#1748018)

* Mon Aug 19 2019 Miro Hrončok <mhroncok@redhat.com> - 4.23.8-4
- Rebuilt for Python 3.8

* Thu Aug 15 2019 Miro Hrončok <mhroncok@redhat.com> - 4.23.8-3
- Bootstrap for Python 3.8

* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 4.23.8-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild

* Tue May 28 2019 Miro Hrončok <mhroncok@redhat.com> - 4.23.8-1
- Update to 4.23.8 (#1711096)

* Thu May 09 2019 Miro Hrončok <mhroncok@redhat.com> - 4.23.4-1
- Update to 4.23.4 (#1609770)

* Sat Mar 09 2019 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 4.9.0-1
- Update to 4.9.0

* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.66.11-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild

* Sat Jul 28 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 3.66.11-1
- Update to 3.66.11

* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.66.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

* Sat Jul 07 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 3.66.0-1
- Update to 3.66.0

* Sat Jul 07 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 3.56.7-1
- Update to 3.56.7

* Thu Jun 14 2018 Miro Hrončok <mhroncok@redhat.com> - 3.49.0-2
- Rebuilt for Python 3.7

* Mon Mar 12 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 3.49.0-1
- Update to 3.49.0

* Mon Mar 12 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 3.47.0-1
- Update to 3.47.0

* Sun Feb 11 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 3.44.24-4
- Pick up automatic dependency from generator

* Sat Feb 10 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 3.44.24-3
- Add missing dependency on enum34

* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.44.24-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Sun Jan 28 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 3.44.24-1
- Update to 3.44.24

* Sat Jan 20 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 3.44.18-1
- Update to 3.44.18

* Mon Jan 15 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 3.44.17-1
- Update to 3.44.17

* Sun Jan 14 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 3.44.16-1
- Update to 3.44.16

* Tue Jan 09 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 3.44.14-1
- Update to 3.44.14

* Mon Jan 08 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 3.44.12-1
- Update to 3.44.12

* Sun Dec 24 2017 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 3.44.4-1
- Update to 3.44.4

* Wed Dec 13 2017 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 3.42.2-1
- Update to 3.42.2

* Thu Nov 23 2017 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 3.38.4-1
- Update to 3.38.4

* Sun Nov 19 2017 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 3.38.0-1
- Update to 3.38.0

* Mon Nov 13 2017 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 3.37.0-1
- Update to 3.37.0

* Sun Nov 12 2017 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 3.36.1-1
- Update to 3.36.1

* Tue Nov 07 2017 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 3.36.0-2
- Use better Obsoletes for platform-python

* Tue Nov 07 2017 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 3.36.0-1
- Update to 3.36.0

* Mon Nov 06 2017 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 3.34.1-1
- Update to 3.34.1

* Sat Nov 04 2017 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 3.34.0-1
- Update to 3.34.0

* Thu Nov 02 2017 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 3.33.1-1
- Update to 3.33.1

* Thu Aug 24 2017 Miro Hrončok <mhroncok@redhat.com> - 3.12.0-4
- Rebuilt for rhbz#1484607

* Thu Aug 10 2017 Tomas Orsava <torsava@redhat.com> - 3.12.0-3
- Added the platform-python subpackage

* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.12.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Mon Jul 10 2017 Michel Alexandre Salim <salimma@fedoraproject.org> - 3.12.0-1
- Update to 3.12.0
- Reenable docs in EPEL7

* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.4.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Fri Dec 09 2016 Charalampos Stratakis <cstratak@redhat.com> - 3.4.0-3
- Rebuild for Python 3.6

* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.4.0-2
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages

* Sun May 29 2016 Michel Alexandre Salim <salimma@fedoraproject.org> - 3.4.0-1
- Update to 3.4.0
- Version the explicit Provides

* Wed May 04 2016 Nathaniel McCallum <npmccallum@redhat.com> - 3.1.3-1
- Update to 3.1.3
- Remove unused code
- Remove unused dependencies

* Sun Feb 14 2016 Michel Salim <salimma@fedoraproject.org> - 2.0.0-1
- Update to 2.0.0

* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.11.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Tue Nov 10 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org>
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5

* Fri Sep 25 2015 Michel Salim <salimma@fedoraproject.org> - 1.11.2-1
- Update to 1.11.2

* Sun Sep 20 2015 Michel Alexandre Salim <salimma@fedoraproject.org> - 1.11.1-1
- Update to 1.11.1

* Wed Sep  2 2015 Michel Alexandre Salim <salimma@fedoraproject.org> - 1.11.0-1
- Update to 1.11.0

* Tue Sep  1 2015 Michel Alexandre Salim <salimma@fedoraproject.org> - 1.10.6-3
- Re-disable tests for now

* Tue Sep  1 2015 Michel Alexandre Salim <salimma@fedoraproject.org> - 1.10.6-2
- Disable Python3 tests - need debugging on ARM builders

* Mon Aug 31 2015 Michel Alexandre Salim <salimma@fedoraproject.org> - 1.10.6-1
- Update to 1.10.6
- Enable tests

* Fri Aug  7 2015 Michel Alexandre Salim <salimma@fedoraproject.org> - 1.10.0-1
- Update to 1.10

* Wed Jul 29 2015 Michel Alexandre Salim <salimma@fedoraproject.org> - 1.9.0-1
- Update to 1.9.0

* Fri Jul 24 2015 Michel Alexandre Salim <salimma@fedoraproject.org> - 1.8.5-2
- Remove she-bang from tools/mergedbs.py
- Include manpage

* Fri Jul 24 2015 Michel Alexandre Salim <salimma@fedoraproject.org> - 1.8.5-1
- Update to 1.8.5
- Make Python3 build unconditional

* Thu Jul 23 2015 Michel Alexandre Salim <salimma@fedoraproject.org> - 1.8.2-1
- Initial package

