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-stestr.changes b/python-stestr.changes
index baf48c6..762c18b 100644
--- a/python-stestr.changes
+++ b/python-stestr.changes
@@ -1,3 +1,10 @@
+-------------------------------------------------------------------
+Sun Nov 17 17:19:01 UTC 2019 - Hans-Peter Jansen
+
+- Create multibuild for testing in order to cope with a circular
+ dependency with python-cliff
+- Clean up spec file
+
-------------------------------------------------------------------
Wed Oct 30 13:17:37 UTC 2019 - Dirk Mueller
diff --git a/python-stestr.spec b/python-stestr.spec
index a21c89d..de54032 100644
--- a/python-stestr.spec
+++ b/python-stestr.spec
@@ -1,7 +1,7 @@
#
# spec file for package python-stestr
#
-# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2019 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -17,7 +17,15 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
-Name: python-stestr
+%global flavor @BUILD_FLAVOR@%{nil}
+%if "%{flavor}" == "test"
+%define psuffix -%{flavor}
+%bcond_without test
+%else
+%define psuffix %{nil}
+%bcond_with test
+%endif
+Name: python-stestr%{psuffix}
Version: 2.5.1
Release: 0
Summary: A test runner runner similar to testrepository
@@ -25,21 +33,8 @@ License: Apache-2.0
Group: Development/Languages/Python
URL: https://github.com/mtreinish/stestr
Source: https://files.pythonhosted.org/packages/source/s/stestr/stestr-%{version}.tar.gz
-BuildRequires: %{python_module PyYAML >= 3.10.0}
-BuildRequires: %{python_module SQLAlchemy}
-BuildRequires: %{python_module cliff >= 2.8.0}
-BuildRequires: %{python_module coverage >= 4.0}
-BuildRequires: %{python_module ddt >= 1.0.1}
-BuildRequires: %{python_module fixtures >= 3.0.0}
-BuildRequires: %{python_module future}
-BuildRequires: %{python_module mock >= 2.0}
BuildRequires: %{python_module pbr >= 2.0.0}
-BuildRequires: %{python_module pytest}
-BuildRequires: %{python_module python-subunit >= 1.3.0}
BuildRequires: %{python_module setuptools}
-BuildRequires: %{python_module six >= 1.10.0}
-BuildRequires: %{python_module testtools >= 2.2.0}
-BuildRequires: %{python_module voluptuous >= 0.8.9}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
BuildRequires: python3-dbm
@@ -52,16 +47,32 @@ Requires: python-python-subunit >= 1.3.0
Requires: python-six >= 1.10.0
Requires: python-testtools >= 2.2.0
Requires: python-voluptuous >= 0.8.9
+Requires(post): update-alternatives
+Requires(postun): update-alternatives
+BuildArch: noarch
+%if %{with test}
+BuildRequires: %{python_module PyYAML >= 3.10.0}
+BuildRequires: %{python_module SQLAlchemy}
+BuildRequires: %{python_module cliff >= 2.8.0}
+BuildRequires: %{python_module coverage >= 4.0}
+BuildRequires: %{python_module ddt >= 1.0.1}
+BuildRequires: %{python_module fixtures >= 3.0.0}
+BuildRequires: %{python_module future}
+BuildRequires: %{python_module mock >= 2.0}
+BuildRequires: %{python_module pytest}
+BuildRequires: %{python_module python-subunit >= 1.3.0}
+BuildRequires: %{python_module six >= 1.10.0}
+BuildRequires: %{python_module stestr >= %{version}}
+BuildRequires: %{python_module testtools >= 2.2.0}
+BuildRequires: %{python_module voluptuous >= 0.8.9}
+%endif
%ifpython3
Requires: python-dbm
%endif
-Requires(post): update-alternatives
-Requires(postun): update-alternatives
%if !0%{?_no_weakdeps}
Recommends: python-SQLAlchemy
Recommends: python-subunit2sql >= 1.8.0
%endif
-BuildArch: noarch
%python_subpackages
%description
@@ -77,6 +88,13 @@ and has examples.
# do not test sql
rm stestr/tests/repository/test_sql.py
+%if %{with test}
+%check
+export LC_ALL="en_US.UTF8"
+%pytest stestr/tests -k 'not test_empty_with_pretty_out'
+%endif
+
+%if ! %{with test}
%build
export LC_ALL="en_US.UTF8"
%python_build
@@ -87,21 +105,6 @@ export LC_ALL="en_US.UTF8"
%python_clone -a %{buildroot}%{_bindir}/stestr
%python_expand %fdupes %{buildroot}%{$python_sitelib}
-%check
-export LC_ALL="en_US.UTF8"
-# test_empty_with_pretty_out - edge case not triggered in OBS
-%{python_expand mkdir build/bin
-for filepath in %{buildroot}/%{_bindir}/stestr*-%{$python_bin_suffix}; do
- filename=$(basename $filepath)
- unsuffixed=${filename/-%{$python_bin_suffix}/}
- cp $filepath build/bin/$unsuffixed
-done
-export PATH="$(pwd)/build/bin:$PATH"
-export PYTHONPATH=%{buildroot}%{$python_sitelib}
-py.test-%{$python_bin_suffix} -v stestr/tests -k 'not test_empty_with_pretty_out'
-rm -r build/bin
-}
-
%post
%python_install_alternative stestr
@@ -113,5 +116,6 @@ rm -r build/bin
%doc ChangeLog README.rst
%python_alternative %{_bindir}/stestr
%{python_sitelib}/*
+%endif
%changelog