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-passlib.changes b/python-passlib.changes
index 01a6a7d..89eb6bf 100644
--- a/python-passlib.changes
+++ b/python-passlib.changes
@@ -1,3 +1,11 @@
+-------------------------------------------------------------------
+Thu Jan 28 08:50:11 UTC 2021 - Antonio Larrosa
+
+- Use _multibuild to only have the test dependencies as
+ buildrequires of the test build.
+- Have optional test dependencies (Django and scrypt) that are not
+ available in SLE only be buildrequired in TW.
+
-------------------------------------------------------------------
Sat Nov 21 00:01:52 UTC 2020 - John Vandenberg
diff --git a/python-passlib.spec b/python-passlib.spec
index f25dc15..7559540 100644
--- a/python-passlib.spec
+++ b/python-passlib.spec
@@ -1,7 +1,7 @@
#
# spec file for package python-passlib
#
-# Copyright (c) 2020 SUSE LLC
+# Copyright (c) 2021 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -16,8 +16,17 @@
#
+%global flavor @BUILD_FLAVOR@%{nil}
+%if "%{flavor}" == "test"
+%define psuffix -test
+%bcond_without test
+%else
+%define psuffix %{nil}
+%bcond_with test
+%endif
+
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
-Name: python-passlib
+Name: python-passlib%{psuffix}
Version: 1.7.4
Release: 0
Summary: Password hashing framework supporting over 20 schemes
@@ -25,16 +34,20 @@ License: BSD-3-Clause
Group: Development/Languages/Python
URL: https://foss.heptapod.net/python-libs/passlib
Source: https://files.pythonhosted.org/packages/source/p/passlib/passlib-%{version}.tar.gz
+BuildRequires: %{python_module setuptools}
+BuildRequires: fdupes
+BuildRequires: python-rpm-macros
+%if %{with test}
BuildRequires: %{python_module argon2_cffi}
BuildRequires: %{python_module bcrypt}
BuildRequires: %{python_module cryptography}
-BuildRequires: %{python_module Django}
BuildRequires: %{python_module pytest}
+%if 0%{?suse_version} >= 1550
+BuildRequires: %{python_module Django}
BuildRequires: %{python_module scrypt}
-BuildRequires: %{python_module setuptools}
+%endif
BuildRequires: apache2-utils
-BuildRequires: fdupes
-BuildRequires: python-rpm-macros
+%endif
Recommends: python-argon2_cffi
Recommends: python-bcrypt
Recommends: python-cryptography
@@ -56,16 +69,22 @@ applications.
%python_build
%install
+%if !%{with test}
%python_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
+%endif
%check
+%if %{with test}
%pytest -rs
+%endif
+%if !%{with test}
%files %{python_files}
%license LICENSE
%doc README
%{python_sitelib}/passlib
%{python_sitelib}/passlib-%{version}-py%{python_version}.egg-info
+%endif
%changelog