|
|
@ -1,8 +1,15 @@
|
|
|
|
# Tests requiring Internet connections are disabled by default
|
|
|
|
# Tests are disbaled by default, they require:
|
|
|
|
# pass --with internet to run them (e.g. when doing a local rebuild
|
|
|
|
# a) tested tox to be installed
|
|
|
|
# for sanity checks before committing). Example:
|
|
|
|
# b) internet connection
|
|
|
|
# $ mock --enable-network --with internet <SRPM>
|
|
|
|
# To test, do the following:
|
|
|
|
%bcond_with internet
|
|
|
|
# 1) Build --without tests (the default)
|
|
|
|
|
|
|
|
# (e.g. fedpkg mockbuild)
|
|
|
|
|
|
|
|
# 2) Install the built package
|
|
|
|
|
|
|
|
# (e.g. mock install ./results_python-tox/.../python3-tox-...rpm)
|
|
|
|
|
|
|
|
# 3) Build again --with tests (and internet connection)
|
|
|
|
|
|
|
|
# (e.g. fedpkg mockbuild --enable-network --no-clean-all)
|
|
|
|
|
|
|
|
# The Fedora CI tests do this.
|
|
|
|
|
|
|
|
%bcond_with tests
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%global pypi_name tox
|
|
|
|
%global pypi_name tox
|
|
|
@ -62,8 +69,7 @@ Obsoletes: python2-tox < 2.9.1-4
|
|
|
|
# Replace detox (no longer supported, functionality is now in tox)
|
|
|
|
# Replace detox (no longer supported, functionality is now in tox)
|
|
|
|
Obsoletes: python3-detox < 0.19-5
|
|
|
|
Obsoletes: python3-detox < 0.19-5
|
|
|
|
|
|
|
|
|
|
|
|
%if %{with internet}
|
|
|
|
%if %{with tests}
|
|
|
|
# for tests
|
|
|
|
|
|
|
|
BuildRequires: python3-filelock
|
|
|
|
BuildRequires: python3-filelock
|
|
|
|
BuildRequires: python3-flaky
|
|
|
|
BuildRequires: python3-flaky
|
|
|
|
BuildRequires: python3-freezegun
|
|
|
|
BuildRequires: python3-freezegun
|
|
|
@ -76,7 +82,7 @@ BuildRequires: python3-psutil
|
|
|
|
BuildRequires: python3-py
|
|
|
|
BuildRequires: python3-py
|
|
|
|
BuildRequires: python3-pytest
|
|
|
|
BuildRequires: python3-pytest
|
|
|
|
BuildRequires: python3-pytest-mock
|
|
|
|
BuildRequires: python3-pytest-mock
|
|
|
|
#BuildRequires: python3-pytest-randomly -- not packaged
|
|
|
|
BuildRequires: python3-pytest-randomly
|
|
|
|
BuildRequires: python3-pytest-xdist
|
|
|
|
BuildRequires: python3-pytest-xdist
|
|
|
|
BuildRequires: python3-toml
|
|
|
|
BuildRequires: python3-toml
|
|
|
|
BuildRequires: python3-virtualenv
|
|
|
|
BuildRequires: python3-virtualenv
|
|
|
@ -84,8 +90,13 @@ BuildRequires: python3-wheel
|
|
|
|
BuildRequires: (python3-importlib-metadata if python3 < 3.8)
|
|
|
|
BuildRequires: (python3-importlib-metadata if python3 < 3.8)
|
|
|
|
BuildRequires: /usr/bin/gcc
|
|
|
|
BuildRequires: /usr/bin/gcc
|
|
|
|
BuildRequires: /usr/bin/git
|
|
|
|
BuildRequires: /usr/bin/git
|
|
|
|
|
|
|
|
BuildRequires: /usr/bin/pip
|
|
|
|
BuildRequires: /usr/bin/poetry
|
|
|
|
BuildRequires: /usr/bin/poetry
|
|
|
|
|
|
|
|
BuildRequires: /usr/bin/pytest
|
|
|
|
|
|
|
|
BuildRequires: /usr/bin/python
|
|
|
|
BuildRequires: libffi-devel
|
|
|
|
BuildRequires: libffi-devel
|
|
|
|
|
|
|
|
# The tests only work if the tested tox is installed :(
|
|
|
|
|
|
|
|
BuildRequires: %{pypi_name} = %{version}-%{release}
|
|
|
|
%endif
|
|
|
|
%endif
|
|
|
|
|
|
|
|
|
|
|
|
%?python_enable_dependency_generator
|
|
|
|
%?python_enable_dependency_generator
|
|
|
@ -114,29 +125,9 @@ rm -rf %{pypi_name}.egg-info
|
|
|
|
%install
|
|
|
|
%install
|
|
|
|
%py3_install
|
|
|
|
%py3_install
|
|
|
|
|
|
|
|
|
|
|
|
# if internet connection available, run tests
|
|
|
|
%if %{with tests}
|
|
|
|
%if %{with internet}
|
|
|
|
|
|
|
|
%check
|
|
|
|
%check
|
|
|
|
# there will be failures like
|
|
|
|
%pytest -n auto
|
|
|
|
# ModuleNotFoundError: tox
|
|
|
|
|
|
|
|
# or InterpreterNotFound: python
|
|
|
|
|
|
|
|
# We juggle the environment variables as much as we can, but it's not perfect.
|
|
|
|
|
|
|
|
# To workaround this:
|
|
|
|
|
|
|
|
# 1. build --without internet
|
|
|
|
|
|
|
|
# 2. install the new python3-tox
|
|
|
|
|
|
|
|
# 3. build --with internet
|
|
|
|
|
|
|
|
mkdir .path
|
|
|
|
|
|
|
|
ln -s %{__python3} .path/python
|
|
|
|
|
|
|
|
ln -s /usr/bin/easy_install-%{python3_version} .path/easy_install
|
|
|
|
|
|
|
|
ln -s /usr/bin/pytest-%{python3_version} .path/pytest
|
|
|
|
|
|
|
|
ln -s /usr/bin/pip3 .path/pip
|
|
|
|
|
|
|
|
export PATH=$(pwd)/.path:%{buildroot}%{_bindir}:$PATH
|
|
|
|
|
|
|
|
export PYTHONPATH=%{buildroot}%{python3_sitelib}
|
|
|
|
|
|
|
|
export TOXENV=py%{python3_version_nodots}
|
|
|
|
|
|
|
|
export TOX_TESTENV_PASSENV="PATH TOX_TESTENV_PASSENV"
|
|
|
|
|
|
|
|
# TODO figure out why PEP517/518 tests and test_provision_cli_args_ignore won't pass
|
|
|
|
|
|
|
|
pytest-3 -n auto -k "not test_verbose_isolated_build and not test_dist_exists_version_change and not test_provision_cli_args_ignore"
|
|
|
|
|
|
|
|
rm -rf .path
|
|
|
|
|
|
|
|
%endif
|
|
|
|
%endif
|
|
|
|
|
|
|
|
|
|
|
|
%files -n python3-%{pypi_name}
|
|
|
|
%files -n python3-%{pypi_name}
|
|
|
|