python-pytest-mock/python-pytest-mock.spec

77 lines
2.3 KiB
RPMSpec

#
# spec file for package python-pytest-mock
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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 http://bugs.opensuse.org/
#
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define modname pytest-mock
Name: python-%{modname}
Version: 1.6.0
Release: 0
Summary: Thin-wrapper around the mock package for easier use with pytest
License: MIT
Group: Development/Languages/Python
Url: https://github.com/pytest-dev/%{modname}
Source: https://files.pythonhosted.org/packages/source/p/%{modname}/%{modname}-%{version}.tar.gz
BuildRequires: %{python_module setuptools_scm}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module virtualenv}
%if 0%{?suse_version} < 1330
BuildRequires: python-mock
%else
BuildRequires: python2-mock
%endif
BuildRequires: python-rpm-macros
Requires: python-pytest
%ifpython2
Requires: python-mock
%else
Recommends: python-mock
%endif
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
%python_subpackages
%description
This plugin installs a ``mocker`` fixture which is a thin-wrapper around the patching API
provided by the `mock` package,
but with the benefit of not having to worry about undoing patches at the end
of a test
%prep
%setup -q -n %{modname}-%{version}
%build
%python_build
%install
%python_install
%check
%{python_expand $python -m virtualenv --system-site-packages env-%{$python_bin_suffix}
. env-%{$python_bin_suffix}/bin/activate
$python setup.py install
$python -m pytest test_pytest_mock.py
deactivate }
%files %{python_files}
%defattr(-,root,root,-)
%{python_sitelib}/*
%changelog