%bcond_without tests %if %{defined rhel} # The cli and ghostwriter extras require black, which is not currently in # RHEL/EPEL 10. It was requested in rhbz#2319803, but the maintainer doesn't # think it's a good fit due to the fact that black doesn't have a stable Python # API. %bcond_with cli %bcond_with ghostwriter # The django extra requires django, which is not currently in RHEL/EPEL 10. # It has been requested in rhbz#2319809. %bcond_with django # The codemods extra requires libcst, which is not currently in RHEL/EPEL 10. # It has been requested in rhbz#2319805. %bcond_with codemods # Building the docs need several sphinx extensions (sphinx-hoverxref, # sphinx-jsonschema, sphinx-rtd-theme, sphinx_selective_exclude) that are not # currently in RHEL/EPEL 10. %bcond_with doc %else %bcond_without cli %bcond_without ghostwriter %bcond_without django %bcond_without codemods %bcond_without doc %endif Name: python-hypothesis Version: 6.151.9 Release: %autorelease Summary: Library for property based testing License: MPL-2.0 URL: https://github.com/HypothesisWorks/hypothesis Source: %{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} # Test dependencies are spread across multiple files with # `-r` style links between them, so it's easier to list the # required test dependencies here manually. BuildRequires: %{py3_dist attrs} BuildRequires: %{py3_dist pexpect} BuildRequires: %{py3_dist pytest} BuildRequires: %{py3_dist pytest-xdist} BuildRequires: %{py3_dist watchdog} # optional test dependencies: BuildRequires: %{py3_dist typing_extensions} %endif %if %{with doc} BuildRequires: %{_bindir}/sphinx-build BuildRequires: %{py3_dist sphinx-hoverxref} BuildRequires: %{py3_dist sphinx-jsonschema} 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 pytz,dateutil,lark,numpy,pandas,pytest,redis,zoneinfo%{?with_cli:,cli}%{?with_ghostwriter:,ghostwriter}%{?with_django:,django}%{?with_codemods:,codemods} # extras with missing deps: # dpcontracts: dpcontracts # crosshair: hypothesis-crosshair, crosshair-tool # extras with missing deps on RHEL/EPEL: # cli: black, rich # ghostwriter: black # django: django # codemods: libcst %{pyproject_extras_subpkg -n python%{python3_pkgversion}-hypothesis %{extras}} %prep %autosetup -n hypothesis-hypothesis-python-%{version}/hypothesis-python -N # 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 # disable Sphinx pinning sed -i -e 's/needs_sphinx/no_needs_sphinx/' docs/conf.py %generate_buildrequires %pyproject_buildrequires %{?with_tests:-x %{extras}} %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 -l hypothesis '_hypothesis_*' %if %{with doc} install -Dpm0644 -t %{buildroot}%{_mandir}/man1 docs/_build/man/hypothesis.1 %endif %if %{with tests} %check # TODO: investigate why test_registered_from_entrypoint is failing k="not test_registered_from_entrypoint" %pytest -v -n auto -k "$k" \ %if %{without ghostwriter} --ignore tests/ghostwriter \ %endif %if %{without codemods} --ignore tests/codemods --ignore tests/patching \ %endif --ignore tests/dpcontracts \ --ignore tests/redis \ --ignore tests/crosshair \ # 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} %doc README.md %{_bindir}/hypothesis %if %{with doc} %{_mandir}/man1/hypothesis.1* %endif %changelog %autochangelog