File python3-pytest.spec of Package python3-pytest

#
# spec file for package python3-pytest
#
# Copyright (c) 2016 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/
#


Name:           python3-pytest
Version:        2.9.1
Release:        0
Summary:        Simple powerful testing with Python
License:        MIT
Group:          Development/Languages/Python
Url:            http://pytest.org
Source:         https://files.pythonhosted.org/packages/source/p/pytest/pytest-%{version}.tar.gz
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  python3
BuildRequires:  python3-devel
# Test requirements:
%if 0%{?suse_version} <= 1310
# mock is built-in for python 3.4
BuildRequires:  python3-mock
%endif
BuildRequires:  python3-PyYAML
BuildRequires:  python3-py >= 1.4.22
BuildRequires:  python3-setuptools
Requires:       python3-py >= 1.4.22
Requires:       python3-setuptools
Requires(post): update-alternatives
Requires(postun): update-alternatives
BuildArch:      noarch

%description
pytest helps you write better programs. It is a a mature full-featured,
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.5 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}
#TODO(saschpe): Fix failing tests:
# rm testing/test_junitxml.py

%build
python3 setup.py build

%install
python3 setup.py install --prefix=%{_prefix} --root=%{buildroot}
rm %{buildroot}%{_bindir}/py.test 
ln -s %{_bindir}/py.test-%{py3_ver} %{buildroot}%{_bindir}/py.test

%check
python3 setup.py test 

%pre
# Since /usr/bin/py.test became ghosted to be used
# with update-alternatives, we have to get rid of the old binary resulting from the
# non-update-alternativies-ified package:
[ -h %{_bindir}/py.test ] || rm -f %{_bindir}/py.test

%post
update-alternatives \
    --install %{_bindir}/py.test py.test %{_bindir}/py.test-%{py3_ver} 30

%preun
if [ $1 -eq 0 ] ; then
    update-alternatives --remove py.test %{_bindir}/py.test-%{py3_ver}
fi

%files
%defattr(-,root,root,-)
%doc LICENSE README.rst CHANGELOG.rst
%ghost %{_bindir}/py.test
%ghost %{_sysconfdir}/alternatives/py.test
%{_bindir}/py.test-%{py3_ver}
%{python3_sitelib}/*

%changelog
openSUSE Build Service is sponsored by