b0d91f9
# Many tests are enabled by default
7739b63
%bcond tests 1
b0d91f9
# However, some tests are disabled by default, becasue they require:
b0d91f9
#  a) tested tox to be installed and/or
b0cb698
#  b) internet connection
b0d91f9
# To run them, do the following:
b0d91f9
#  1) Build --without ci_tests (the default) and optionally --without tests
b0d91f9
#     (e.g. fedpkg mockbuild --without tests)
b0cb698
#  2) Install the built package
83c7b43
#     (e.g. mock install ./results_python-tox/.../tox-...rpm)
b0d91f9
#  3) Build again --with ci_tests (and internet connection)
b0d91f9
#     (e.g. fedpkg mockbuild --no-clean-all --enable-network --with ci_tests)
b0cb698
# The Fedora CI tests do this.
7739b63
%bcond ci_tests 0
3137e7c
455a6d9
# Unset -s on python shebang - ensure that extensions installed with pip
455a6d9
# to user locations are seen and properly loaded
455a6d9
# Fixes https://bugzilla.redhat.com/2057015
1209401
%undefine _py3_shebang_s
455a6d9
e2c1378
Name:           python-tox
f1b5240
Version:        4.11.1
f480c33
Release:        %autorelease
3137e7c
Summary:        Virtualenv-based automation of test activities
3137e7c
cb1dcfe
License:        MIT
cbb1e4c
URL:            https://tox.readthedocs.io/
2e83f2e
Source:         %{pypi_source tox}
e2c1378
b445b57
# Remove dependency on devpi-process.
9ec60fc
# Remove dependency on detect-test-pollution.
b0d91f9
# Remove coverage-related dependencies.
b0d91f9
# Adjust virtualenv environment variables to make it work with our patched virtualenv.
2e83f2e
Patch:          fix-tests.patch
b0d91f9
1fd92e9
BuildArch:      noarch
3137e7c
e2c1378
BuildRequires:  python3-devel
e2c1378
BuildRequires:  pyproject-rpm-macros
e2c1378
e2c1378
%if %{with tests}
e2c1378
BuildRequires:  /usr/bin/gcc
e2c1378
BuildRequires:  /usr/bin/git
e2c1378
BuildRequires:  /usr/bin/pip
e2c1378
BuildRequires:  /usr/bin/pytest
e2c1378
BuildRequires:  /usr/bin/python
e2c1378
BuildRequires:  libffi-devel
5591696
# xdist is not used upstream, but we use it to speed up the %%check
5591696
BuildRequires:  python3-pytest-xdist
9ec60fc
# for test_allowed_implicit_cli_envs[py310]
9ec60fc
# TODO remove this once https://github.com/tox-dev/tox/pull/3108 is released
9ec60fc
BuildRequires:  python3.10
b0d91f9
%if %{with ci_tests}
b0d91f9
# The CI tests only work if the tested tox is installed :(
e2c1378
BuildRequires:  tox = %{version}-%{release}
e2c1378
%endif
b0d91f9
%endif
e2c1378
e2c1378
%global _description %{expand:
32f1962
Tox as is a generic virtualenv management and test command line tool you
1fd92e9
can use for:
6683010
32f1962
 - checking your package installs correctly with different Python versions
1fd92e9
   and interpreters
32f1962
 - running your tests in each of the environments, configuring your test tool
1fd92e9
   of choice
32f1962
 - acting as a frontend to Continuous Integration servers, greatly reducing
e2c1378
   boilerplate and merging CI and shell-based testing.}
e2c1378
e2c1378
%description %_description
1fd92e9
1fd92e9
e2c1378
%package -n tox
1fd92e9
Summary:        %{summary}
1fd92e9
454e6cd
# Recommend "all the Pythons"
c286211
# Why? Tox exists to enable developers to test libraries against various Python
c286211
# versions, with just "dnf install tox" and a config file.
c286211
# See: https://developer.fedoraproject.org/tech/languages/python/python-installation.html#using-virtualenv
c286211
# Tox itself runs on the system python3 (i.e. %%{python3_version},
c286211
# however it launches other Python versions as subprocesses.
c286211
# It recommends all Python versions it supports. (This is an exception to
c286211
# the rule that Fedora packages may not require the alternative interpreters.)
b680470
Recommends:     python2.7
b680470
Recommends:     python3.6
b680470
Recommends:     python3.7
b680470
Recommends:     python3.8
b680470
Recommends:     python3.9
7220117
Recommends:     python3.10
cb1dcfe
Recommends:     pypy2-devel
f0d7c36
Recommends:     pypy3-devel
ee3f834
Recommends:     python2-devel
f0d7c36
Recommends:     python3-devel
0e1b27d
# Instead of adding new Pythons here, add `Supplements: tox` to them, see:
0e1b27d
# https://lists.fedoraproject.org/archives/list/python-devel@lists.fedoraproject.org/thread/NVVUXSVSPFQOWIGBE2JNI67HEO7R63ZQ/
454e6cd
e2c1378
%py_provides    python3-tox
e2c1378
# Remove this once Fedora 36 goes EOL:
667844d
Obsoletes:      python3-tox < 3.24.4-2
3014377
e2c1378
%description -n tox %_description
b16e8f3
b16e8f3
795f3eb
%prep
e2c1378
%autosetup -p1 -n tox-%{version}
795f3eb
b0d91f9
# Upstream updates dependencies too aggressively
b0d91f9
# see https://github.com/tox-dev/tox/pull/2843#discussion_r1065028356
9ec60fc
sed -ri -e 's/"(packaging|filelock|platformdirs|psutil|diff-cover|pyproject-api|pytest|pytest-mock|pytest-xdist|wheel|pluggy|distlib|cachetools)>=.*/"\1",/g' \
9ec60fc
        -e "s/'(time-machine)>=[^;']+/'\1/" \
fac05c2
        -e 's/"(virtualenv)>=.*/"\1>=20",/g' \
342aea9
        -e 's/"(hatchling)>=.*/"\1>=1.13",/g' \
fac05c2
    pyproject.toml
3d1b4d7
e2c1378
%generate_buildrequires
b0d91f9
export SETUPTOOLS_SCM_PRETEND_VERSION="%{version}"
3b05ca4
%pyproject_buildrequires -r %{?with_tests:-x testing}
e2c1378
6683010
3137e7c
%build
b0d91f9
export SETUPTOOLS_SCM_PRETEND_VERSION="%{version}"
e2c1378
%pyproject_wheel
b16e8f3
b16e8f3
3137e7c
%install
e2c1378
%pyproject_install
e2c1378
%pyproject_save_files tox
e2c1378
3137e7c
b0cb698
%if %{with tests}
3137e7c
%check
b0d91f9
# Skipped tests use internal virtualenv functionality to
b0d91f9
# download wheels which does not work with "bundled" version of wheel in
b0d91f9
# the Fedora's virtualenv patch.
b0d91f9
k="${k-}${k+ and }not test_virtualenv_flipped_settings"
b0d91f9
k="${k-}${k+ and }not test_virtualenv_env_ignored_if_set"
b0d91f9
k="${k-}${k+ and }not test_virtualenv_env_used_if_not_set"
b0d91f9
b0d91f9
# The following tests either need internet connection or installed tox
b0d91f9
# so we only run them on the CI.
b0d91f9
%if %{without ci_tests}
b0d91f9
k="${k-}${k+ and }not test_virtualenv_flipped_settings"
b0d91f9
k="${k-}${k+ and }not test_virtualenv_env_ignored_if_set"
b0d91f9
k="${k-}${k+ and }not test_virtualenv_env_used_if_not_set"
b0d91f9
k="${k-}${k+ and }not test_build_wheel_external"
b0d91f9
k="${k-}${k+ and }not keyboard_interrupt"
b0d91f9
k="${k-}${k+ and }not test_call_as_module"
b0d91f9
k="${k-}${k+ and }not test_call_as_exe"
b0d91f9
# test_local_execute_* have "\r\n" in outputs for some
b0d91f9
# unknown reason, reported: https://github.com/tox-dev/tox/issues/2841
b0d91f9
k="${k-}${k+ and }not test_local_execute_basic_pass_show_on_standard_newline_flush"
b0d91f9
k="${k-}${k+ and }not test_local_execute_write_a_lot"
b0d91f9
%endif
b0d91f9
342aea9
%pytest -v -n auto -k "${k-}" --run-integration
3137e7c
%endif
b42ab61
e2c1378
e2c1378
%files -n tox -f %{pyproject_files}
e2c1378
%{_bindir}/tox
e2c1378
3137e7c
3137e7c
%changelog
f480c33
%autochangelog