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-mysqlclient.changes b/python-mysqlclient.changes
index cd7d844..cd85520 100644
--- a/python-mysqlclient.changes
+++ b/python-mysqlclient.changes
@@ -1,3 +1,15 @@
+-------------------------------------------------------------------
+Thu Mar 5 13:33:30 UTC 2020 - Kristyna Streitova
+
+- fix test package by adding BuildRequires: %{python_module mysqlclient
+ >= %{version}}
+
+-------------------------------------------------------------------
+Fri Feb 21 10:04:38 UTC 2020 - Kristyna Streitova
+
+- switch to multibuild to run tests and avoid a buildcycle with
+ mariadb
+
-------------------------------------------------------------------
Tue Feb 11 16:02:55 UTC 2020 - pgajdos@suse.com
diff --git a/python-mysqlclient.spec b/python-mysqlclient.spec
index 25542a0..6772015 100644
--- a/python-mysqlclient.spec
+++ b/python-mysqlclient.spec
@@ -18,21 +18,25 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define oldpython python
-Name: python-mysqlclient
+%global flavor @BUILD_FLAVOR@%{nil}
+%if "%{flavor}" == "test"
+%define psuffix -test
+%bcond_without test
+%else
+%define psuffix %{nil}
+%bcond_with test
+%endif
+Name: python-mysqlclient%{psuffix}
Version: 1.4.6
Release: 0
Summary: Python interface to MySQL
License: GPL-2.0-or-later
-Group: Development/Languages/Python
URL: https://github.com/PyMySQL/mysqlclient-python
Source: https://files.pythonhosted.org/packages/source/m/mysqlclient/mysqlclient-%{version}.tar.gz
BuildRequires: %{python_module devel}
-BuildRequires: %{python_module mock}
-BuildRequires: %{python_module pytest}
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: libmysqlclient-devel
-BuildRequires: mariadb-rpm-macros
BuildRequires: python-rpm-macros
BuildRequires: python3-Sphinx
BuildRequires: python3-attrs
@@ -42,6 +46,12 @@ Provides: python-mysql = %{version}
Obsoletes: python-mysql < %{version}
Provides: python-MySQL-python = %{version}
Obsoletes: python-MySQL-python < %{version}
+%if %{with test}
+BuildRequires: %{python_module mock}
+BuildRequires: %{python_module mysqlclient >= %{version}}
+BuildRequires: %{python_module pytest}
+BuildRequires: mariadb-rpm-macros
+%endif
%ifpython2
Provides: %{oldpython}-mysql = %{version}
Obsoletes: %{oldpython}-mysql < %{version}
@@ -59,11 +69,14 @@ This package adds Python 3 support and bug fixes to MySQLdb1.
%setup -q -n mysqlclient-%{version}
%build
+%if !%{with test}
%python_build
python3 setup.py build_sphinx && rm build/sphinx/html/.buildinfo
+%endif
%check
+%if %{with test}
exit_code=0
cconf=abuild-myclient.cnf
#
@@ -85,14 +98,19 @@ export TESTDB="$PWD/$cconf"
#
%mysql_testserver_stop
exit $exit_code
+%endif
%install
+%if !%{with test}
%python_install
%python_expand %fdupes %{buildroot}%{$python_sitearch}
+%endif
+%if !%{with test}
%files %{python_files}
%license LICENSE
%doc HISTORY.rst MANIFEST.in README.md build/sphinx/html
%{python_sitearch}/*
+%endif
%changelog