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-opencensus.changes b/python-opencensus.changes
index 7ca1f7b..8be34fa 100644
--- a/python-opencensus.changes
+++ b/python-opencensus.changes
@@ -1,3 +1,8 @@
+-------------------------------------------------------------------
+Tue Mar 10 11:25:01 UTC 2020 - Tomáš Chvátal
+
+- Switch to multibuild to not cycle during testing
+
-------------------------------------------------------------------
Tue Feb 18 08:47:16 UTC 2020 - Tomáš Chvátal
diff --git a/python-opencensus.spec b/python-opencensus.spec
index 2bd4978..d3a10cc 100644
--- a/python-opencensus.spec
+++ b/python-opencensus.spec
@@ -17,19 +17,22 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
+%global flavor @BUILD_FLAVOR@%{nil}
+%if "%{flavor}" == "test"
+%define psuffix -test
+%bcond_without test
+%else
+%define psuffix %{nil}
+%bcond_with test
+%endif
%bcond_without python2
-Name: python-opencensus
+Name: python-opencensus%{psuffix}
Version: 0.7.7
Release: 0
Summary: A stats collection and distributed tracing framework
License: Apache-2.0
URL: https://github.com/census-instrumentation/opencensus-python
Source: https://github.com/census-instrumentation/opencensus-python/archive/v%{version}.tar.gz
-BuildRequires: %{python_module google-api-core >= 1.0.0}
-BuildRequires: %{python_module mock}
-BuildRequires: %{python_module opencensus-context >= 0.1.1}
-BuildRequires: %{python_module pytest}
-BuildRequires: %{python_module retrying}
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
@@ -37,6 +40,14 @@ Requires: python-google-api-core < 2.0.0
Requires: python-google-api-core >= 1.0.0
Requires: python-opencensus-context >= 0.1.1
BuildArch: noarch
+%if %{with test}
+BuildRequires: %{python_module google-api-core >= 1.0.0}
+BuildRequires: %{python_module mock}
+BuildRequires: %{python_module opencensus >= %{version}}
+BuildRequires: %{python_module opencensus-context >= 0.1.1}
+BuildRequires: %{python_module pytest}
+BuildRequires: %{python_module retrying}
+%endif
%if %{with python2}
BuildRequires: python-unittest2
%endif
@@ -58,15 +69,21 @@ sed -i -e 's:==:>=:g' setup.py
%python_build
%install
+%if !%{with test}
%python_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
+%endif
%check
+%if %{with test}
%pytest tests/unit
+%endif
+%if !%{with test}
%files %{python_files}
%doc CHANGELOG.md README.rst
%license LICENSE
%{python_sitelib}/*
+%endif
%changelog