diff --git a/_multibuild b/_multibuild
new file mode 100644
index 0000000..fcc7b97
--- /dev/null
+++ b/_multibuild
@@ -0,0 +1,3 @@
+
+ test
+
diff --git a/python-virtualenv.changes b/python-virtualenv.changes
index d652c26..330b155 100644
--- a/python-virtualenv.changes
+++ b/python-virtualenv.changes
@@ -1,3 +1,8 @@
+-------------------------------------------------------------------
+Tue Sep 17 18:01:51 UTC 2019 - Tomáš Chvátal
+
+- Use multibuild to avoid cycles with pytest
+
-------------------------------------------------------------------
Mon Sep 16 10:20:57 UTC 2019 - Tomáš Chvátal
diff --git a/python-virtualenv.spec b/python-virtualenv.spec
index 6b0f099..12b6735 100644
--- a/python-virtualenv.spec
+++ b/python-virtualenv.spec
@@ -17,7 +17,15 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
-Name: python-virtualenv
+%global flavor @BUILD_FLAVOR@%{nil}
+%if "%{flavor}" == "test"
+%define psuffix -test
+%bcond_without test
+%else
+%define psuffix %{nil}
+%bcond_with test
+%endif
+Name: python-virtualenv%{psuffix}
Version: 16.7.5
Release: 0
Summary: Virtual Python Environment builder
@@ -25,11 +33,14 @@ License: MIT
Group: Development/Languages/Python
URL: http://www.virtualenv.org/
Source: https://files.pythonhosted.org/packages/source/v/virtualenv/virtualenv-%{version}.tar.gz
+%if %{with test}
BuildRequires: %{python_module mock}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module pypiserver}
BuildRequires: %{python_module pytest-localserver}
BuildRequires: %{python_module pytest}
+BuildRequires: %{python_module virtualenv >= %{version}}
+%endif
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
@@ -68,16 +79,21 @@ libraries either).
%python_build
%install
+%if !%{with test}
%python_install
%python_expand fdupes %{buildroot}%{$python_sitelib}
%python_clone -a %{buildroot}%{_bindir}/virtualenv
+%endif
%check
+%if %{with test}
# test_bootstrap is tied to python2 command calls, skip it
# test_always_copy_option does not handle system install dirs in /usr/lib64
# test_wheel_invocation_dash_p or test_use_from_wheel or test_wheel_contains or test_wheel_basic_invocation; online tests
%pytest -k 'not (test_always_copy_option or test_bootstrap or test_use_from_wheel or test_wheel_contains or test_wheel_basic_invocation or test_wheel_invocation_dash_p)'
+%endif
+%if !%{with test}
%post
%python_install_alternative virtualenv
@@ -90,5 +106,6 @@ libraries either).
%{python_sitelib}/virtualenv*
%python_alternative %{_bindir}/virtualenv
%pycache_only %{python_sitelib}/__pycache__
+%endif
%changelog