File saltbundlepy-pytest.spec of Package saltbundlepy-pytest

#
# spec file for package saltbundlepy-pytest
#
# 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
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


%{?!saltbundlepy_module:%define saltbundlepy_module() saltbundlepy-%{**}}
%define pythons saltbundlepy

# Disable python bytecompile for all distros
# It's called explicitly in the spec
%global __brp_python_bytecompile %{nil}

%global flavor @BUILD_FLAVOR@%{nil}
%if "%{flavor}" == "test"
%define psuffix -test
%bcond_without test
%else
%define psuffix %{nil}
%bcond_with test
%endif

Name:           saltbundlepy-pytest%{psuffix}
Version:        5.4.3
Release:        0
Summary:        Python testing tool with autodiscovery and detailed asserts
License:        MIT
Group:          Development/Languages/Python
URL:            https://github.com/pytest-dev/pytest
Source:         https://files.pythonhosted.org/packages/source/p/pytest/pytest-%{version}.tar.gz
Patch0:         tidy-up-embeddedfile.patch
Patch1:         fix-assertion-rewriting-on-python3.10.patch
BuildRequires:  %{saltbundlepy_module base >= 3.10}
BuildRequires:  %{saltbundlepy_module setuptools >= 40.0}
BuildRequires:  %{saltbundlepy_module setuptools-scm}
BuildRequires:  fdupes
BuildRequires:  saltbundlepy-rpm-macros
Requires:       saltbundlepy-atomicwrites >= 1.0
Requires:       saltbundlepy-attrs >= 17.4.0
Requires:       saltbundlepy-importlib-metadata >= 0.12
Requires:       saltbundlepy-more-itertools >= 4.0.0
Requires:       saltbundlepy-packaging
Requires:       saltbundlepy-pluggy >= 0.12
Requires:       saltbundlepy-py >= 1.5.0
Requires:       saltbundlepy-setuptools
Requires:       saltbundlepy-six >= 1.10.0
Requires:       saltbundlepy-wcwidth
Requires(post): update-alternatives
Requires(postun): update-alternatives
BuildArch:      noarch
%if %{with test}
BuildRequires:  %{saltbundlepy_module hypothesis}
BuildRequires:  %{saltbundlepy_module pytest >= %{version}}
BuildRequires:  %{saltbundlepy_module setuptools_scm}
BuildRequires:  saltbundlepy-funcsigs
BuildRequires:  saltbundlepy-mock
%endif
%python_subpackages

%description
pytest is a cross-project Python testing tool. It provides:

* auto-discovery of test modules and functions,
* detailed info on failing assert statements (no need to remember
  self.assert* names),
* modular fixtures for managing small or parametrized long-lived test resources.
* multi-paradigm support: you can use py.test to run test suites based on
  unittest (or trial), nose,
* single-source compatibility to Python2.4 all the way up to Python3.3,
  PyPy-1.9 and Jython-2.5.1, and
* many external plugins.

%prep
%setup -q -n pytest-%{version}
%autopatch -p1

%build
%python_build

%install
%if ! %{with test}
%python_install
%python_clone -a %{buildroot}%{_bindir}/py.test
%python_clone -a %{buildroot}%{_bindir}/pytest

%python_expand %fdupes %{buildroot}%{$python_sitelib}
%endif

#Check here because in main package creates a buildcycle
%check
%if %{with test}
%pytest
%endif

%post
%{python_install_alternative py.test} \
   --slave %{_bindir}/pytest pytest %{_bindir}/pytest-%{python_version}

%postun
%python_uninstall_alternative py.test

%if ! %{with test}
%files %{python_files}
%doc AUTHORS CHANGELOG.rst README.rst
%license LICENSE
%python_alternative %{_bindir}/py.test
%python_alternative %{_bindir}/pytest
%{python_sitelib}/*
%endif

%changelog
openSUSE Build Service is sponsored by