2020-10-14 23:43:13 +00:00
|
|
|
%global pypi_name pytest
|
|
|
|
Name: python-%{pypi_name}
|
2023-08-30 19:42:51 +00:00
|
|
|
Version: 7.1.3
|
2020-10-14 23:43:13 +00:00
|
|
|
Release: 0%{?dist}
|
|
|
|
Summary: Simple powerful testing with Python
|
|
|
|
License: MIT
|
|
|
|
URL: https://pytest.org
|
|
|
|
Source0: %{pypi_source}
|
|
|
|
|
|
|
|
BuildArch: noarch
|
2021-02-04 13:32:12 +00:00
|
|
|
BuildRequires: python3-devel
|
2020-10-14 23:43:13 +00:00
|
|
|
BuildRequires: pyproject-rpm-macros
|
|
|
|
|
2022-03-17 15:16:06 +00:00
|
|
|
# no xmlschema packaged for EPEL 9 yet, cannot run tests on EPEL
|
|
|
|
%if 0%{?fedora}
|
|
|
|
%bcond_without tests
|
|
|
|
%else
|
|
|
|
%bcond_with tests
|
|
|
|
%endif
|
|
|
|
|
2020-10-14 23:43:13 +00:00
|
|
|
%description
|
|
|
|
This is a pure Python package with executables. It has a test suite in tox.ini
|
|
|
|
and test dependencies specified via the [test] extra.
|
|
|
|
Building this tests:
|
|
|
|
- generating runtime and test dependencies by both tox.ini and extras
|
|
|
|
- pyproject.toml with the setuptools backend and setuptools-scm
|
|
|
|
- passing arguments into %%tox
|
|
|
|
|
|
|
|
%package -n python3-%{pypi_name}
|
|
|
|
Summary: %{summary}
|
|
|
|
|
|
|
|
%description -n python3-%{pypi_name}
|
|
|
|
%{summary}.
|
|
|
|
|
|
|
|
|
|
|
|
%prep
|
|
|
|
%autosetup -p1 -n %{pypi_name}-%{version}
|
2022-03-17 15:16:06 +00:00
|
|
|
# remove optional test dependencies we don't like to pull in
|
|
|
|
sed -E -i '/mock|nose/d' setup.cfg
|
2023-03-31 16:57:54 +00:00
|
|
|
# internal check for our macros: insert a subprocess echo to setup.py
|
|
|
|
# to ensure it's not generated as BuildRequires
|
|
|
|
echo 'import os; os.system("echo if-this-is-generated-the-build-will-fail")' >> setup.py
|
2023-08-30 19:42:51 +00:00
|
|
|
# make this build in EPEL 9
|
|
|
|
sed -i 's/setuptools-scm\[toml\]>=6.2.3/setuptools-scm[toml]>=5/' pyproject.toml
|
2020-10-14 23:43:13 +00:00
|
|
|
|
|
|
|
|
|
|
|
%generate_buildrequires
|
2022-03-17 15:16:06 +00:00
|
|
|
%pyproject_buildrequires %{?with_tests:-x testing -t}
|
|
|
|
|
2020-10-14 23:43:13 +00:00
|
|
|
|
|
|
|
%build
|
|
|
|
%pyproject_wheel
|
|
|
|
|
|
|
|
|
|
|
|
%install
|
|
|
|
%pyproject_install
|
|
|
|
%pyproject_save_files '*pytest' +auto
|
|
|
|
|
|
|
|
|
|
|
|
%check
|
2022-03-17 15:16:06 +00:00
|
|
|
%if %{with tests}
|
2020-10-14 23:43:13 +00:00
|
|
|
# Only run one test (which uses a test-only dependency, hypothesis)
|
|
|
|
# See how to pass options trough the macro to tox, trough tox to pytest
|
2023-08-30 19:42:51 +00:00
|
|
|
%tox -- -- -k "metafunc and not test_parametrize_" -Wdefault
|
2022-03-17 15:16:06 +00:00
|
|
|
%else
|
|
|
|
%pyproject_check_import
|
|
|
|
%endif
|
2020-10-14 23:43:13 +00:00
|
|
|
|
|
|
|
|
|
|
|
%files -n python3-%{pypi_name} -f %{pyproject_files}
|
|
|
|
%doc README.rst
|
|
|
|
%doc CHANGELOG.rst
|
|
|
|
%license LICENSE
|