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-isort.changes b/python-isort.changes
index ac5fbed..be43909 100644
--- a/python-isort.changes
+++ b/python-isort.changes
@@ -1,3 +1,8 @@
+-------------------------------------------------------------------
+Fri Mar 1 14:43:42 UTC 2019 - Tomáš Chvátal
+
+- Switch to multibuild to avoid cycle with pylama
+
-------------------------------------------------------------------
Thu Feb 28 06:07:17 UTC 2019 - John Vandenberg
diff --git a/python-isort.spec b/python-isort.spec
index b2d185a..377ae00 100644
--- a/python-isort.spec
+++ b/python-isort.spec
@@ -16,8 +16,15 @@
#
-%{!?license: %global license %doc}
%{?!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
Name: python-isort
Version: 4.3.9
Release: 0
@@ -26,9 +33,11 @@ License: MIT
Group: Development/Languages/Python
URL: https://github.com/timothycrosley/isort
Source: https://files.pythonhosted.org/packages/source/i/isort/isort-%{version}.tar.gz
+%if %{with test}
BuildRequires: %{python_module mock}
BuildRequires: %{python_module pylama}
BuildRequires: %{python_module pytest}
+%endif
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
@@ -56,15 +65,21 @@ chmod -x LICENSE
%python_build
%install
+%if !%{with test}
%python_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
+%endif
%check
-%python_exec setup.py test
+%if %{with test}
+%python_expand py.test-%{$python_bin_suffix} -v
+%endif
+%if !%{with test}
%files %{python_files}
%{python_sitelib}/isort*
%python3_only %{_bindir}/isort
%license LICENSE
+%endif
%changelog