Blame SPECS/python-tox.spec

0c4bba
%bcond bootstrap 1
0c4bba
# Many tests are enabled by default, unless bootstrapping
0c4bba
%bcond tests %{without bootstrap}
0c4bba
# However, some tests are disabled by default, becasue they require:
0c4bba
#  a) tested tox to be installed and/or
0c4bba
#  b) internet connection
0c4bba
# To run them, do the following:
0c4bba
#  1) Build --without ci_tests (the default) and optionally --without tests
0c4bba
#     (e.g. fedpkg mockbuild --without tests)
0c4bba
#  2) Install the built package
0c4bba
#     (e.g. mock install ./results_python-tox/.../tox-...rpm)
0c4bba
#  3) Build again --with ci_tests (and internet connection)
0c4bba
#     (e.g. fedpkg mockbuild --no-clean-all --enable-network --with ci_tests)
0c4bba
# The Fedora CI tests do this.
0c4bba
%bcond ci_tests 0
0c4bba
0c4bba
# Unset -s on python shebang - ensure that extensions installed with pip
0c4bba
# to user locations are seen and properly loaded
0c4bba
# Fixes https://bugzilla.redhat.com/2057015
0c4bba
%undefine _py3_shebang_s
0c4bba
0c4bba
Name:           python-tox
0c4bba
Version:        4.21.2
0c4bba
Release:        %autorelease
0c4bba
Summary:        Virtualenv-based automation of test activities
0c4bba
0c4bba
License:        MIT
0c4bba
URL:            https://tox.readthedocs.io/
0c4bba
Source:         %{pypi_source tox}
0c4bba
0c4bba
# Remove dependency on devpi-process.
0c4bba
# Remove dependency on detect-test-pollution.
0c4bba
# Remove coverage-related dependencies.
0c4bba
# Adjust virtualenv environment variables to make it work with our patched virtualenv.
0c4bba
Patch:          fix-tests.patch
0c4bba
0c4bba
BuildArch:      noarch
0c4bba
0c4bba
BuildRequires:  python3-devel
0c4bba
BuildRequires:  pyproject-rpm-macros
0c4bba
0c4bba
%if %{with tests}
0c4bba
BuildRequires:  /usr/bin/gcc
0c4bba
BuildRequires:  /usr/bin/git
0c4bba
BuildRequires:  /usr/bin/pip
0c4bba
BuildRequires:  /usr/bin/pytest
0c4bba
BuildRequires:  /usr/bin/python
0c4bba
BuildRequires:  libffi-devel
0c4bba
# xdist is not used upstream, but we use it to speed up the %%check
0c4bba
BuildRequires:  python3-pytest-xdist
0c4bba
%if %{with ci_tests}
0c4bba
# The CI tests only work if the tested tox is installed :(
0c4bba
# This should technically be the same V-R, but the CI does not handle %%autorelease well
0c4bba
BuildRequires:  tox = %{version}
0c4bba
%endif
0c4bba
%endif
0c4bba
0c4bba
%global _description %{expand:
0c4bba
Tox as is a generic virtualenv management and test command line tool you
0c4bba
can use for:
0c4bba
0c4bba
 - checking your package installs correctly with different Python versions
0c4bba
   and interpreters
0c4bba
 - running your tests in each of the environments, configuring your test tool
0c4bba
   of choice
0c4bba
 - acting as a frontend to Continuous Integration servers, greatly reducing
0c4bba
   boilerplate and merging CI and shell-based testing.}
0c4bba
0c4bba
%description %_description
0c4bba
0c4bba
0c4bba
%package -n tox
0c4bba
Summary:        %{summary}
0c4bba
0c4bba
# Recommend "all the Pythons"
0c4bba
# Why? Tox exists to enable developers to test libraries against various Python
0c4bba
# versions, with just "dnf install tox" and a config file.
0c4bba
# See: https://developer.fedoraproject.org/tech/languages/python/python-installation.html#using-virtualenv
0c4bba
# Tox itself runs on the system python3 (i.e. %%{python3_version},
0c4bba
# however it launches other Python versions as subprocesses.
0c4bba
# It recommends all Python versions it supports. (This is an exception to
0c4bba
# the rule that Fedora packages may not require the alternative interpreters.)
0c4bba
Recommends:     python3.8
0c4bba
Recommends:     python3.9
0c4bba
Recommends:     python3.10
0c4bba
Recommends:     pypy3-devel
0c4bba
Recommends:     python3-devel
0c4bba
# Instead of adding new Pythons here, add `Supplements: tox` to them, see:
0c4bba
# https://lists.fedoraproject.org/archives/list/python-devel@lists.fedoraproject.org/thread/NVVUXSVSPFQOWIGBE2JNI67HEO7R63ZQ/
0c4bba
0c4bba
%py_provides    python3-tox
0c4bba
0c4bba
%description -n tox %_description
0c4bba
0c4bba
0c4bba
%prep
0c4bba
%autosetup -p1 -n tox-%{version}
0c4bba
0c4bba
# Upstream updates dependencies too aggressively
0c4bba
# see https://github.com/tox-dev/tox/pull/2843#discussion_r1065028356
0c4bba
sed -ri -e 's/"(packaging|filelock|platformdirs|psutil|pyproject-api|pytest|pytest-mock|pytest-xdist|wheel|pluggy|distlib|cachetools|build\[virtualenv\]|setuptools|flaky)>=.*/"\1",/g' \
0c4bba
        -e 's/"(time-machine)>=[^;"]+/"\1/' \
0c4bba
        -e 's/"(virtualenv)>=.*/"\1>=20",/g' \
0c4bba
        -e 's/"(hatchling)>=.*/"\1>=1.13",/g' \
0c4bba
    pyproject.toml
0c4bba
0c4bba
%generate_buildrequires
0c4bba
export SETUPTOOLS_SCM_PRETEND_VERSION="%{version}"
0c4bba
%pyproject_buildrequires -r %{?with_tests:-x testing}
0c4bba
0c4bba
0c4bba
%build
0c4bba
export SETUPTOOLS_SCM_PRETEND_VERSION="%{version}"
0c4bba
%pyproject_wheel
0c4bba
0c4bba
0c4bba
%install
0c4bba
%pyproject_install
0c4bba
%pyproject_save_files tox
0c4bba
0c4bba
0c4bba
%if %{with tests}
0c4bba
%check
0c4bba
# Skipped tests use internal virtualenv functionality to
0c4bba
# download wheels which does not work with "bundled" version of wheel in
0c4bba
# the Fedora's virtualenv patch.
0c4bba
k="${k-}${k+ and }not test_virtualenv_flipped_settings"
0c4bba
k="${k-}${k+ and }not test_virtualenv_env_ignored_if_set"
0c4bba
k="${k-}${k+ and }not test_virtualenv_env_used_if_not_set"
0c4bba
0c4bba
# https://github.com/tox-dev/tox/issues/3290
0c4bba
%if v"0%{?python3_version}" >= v"3.13"
0c4bba
k="${k-}${k+ and }not test_str_convert_ok_py39"
0c4bba
%endif
0c4bba
0c4bba
# https://github.com/tox-dev/tox/commit/698f1dd663
0c4bba
# Until we have setuptools 70.1+ we skip those
0c4bba
k="${k-}${k+ and }not test_result_json_sequential"
0c4bba
k="${k-}${k+ and }not test_setuptools_package"
0c4bba
k="${k-}${k+ and }not test_skip_develop_mode"
0c4bba
k="${k-}${k+ and }not test_tox_install_pkg_sdist"
0c4bba
0c4bba
# The following tests either need internet connection or installed tox
0c4bba
# so we only run them on the CI.
0c4bba
%if %{without ci_tests}
0c4bba
k="${k-}${k+ and }not test_virtualenv_flipped_settings"
0c4bba
k="${k-}${k+ and }not test_virtualenv_env_ignored_if_set"
0c4bba
k="${k-}${k+ and }not test_virtualenv_env_used_if_not_set"
0c4bba
k="${k-}${k+ and }not test_build_wheel_external"
0c4bba
k="${k-}${k+ and }not keyboard_interrupt"
0c4bba
k="${k-}${k+ and }not test_call_as_module"
0c4bba
k="${k-}${k+ and }not test_call_as_exe"
0c4bba
k="${k-}${k+ and }not test_run_installpkg_targz"
0c4bba
%endif
0c4bba
0c4bba
%pytest -v -n auto -k "${k-}" --run-integration
0c4bba
%endif
0c4bba
0c4bba
0c4bba
%files -n tox -f %{pyproject_files}
0c4bba
%{_bindir}/tox
0c4bba
0c4bba
0c4bba
%changelog
0c4bba
%autochangelog