8205b3a
%if 0%{?fedora} > 12
9c5eb1f
%global with_python3 1
9c5eb1f
%endif
9c5eb1f
%if 0%{?rhel} && 0%{?rhel} < 6
9c5eb1f
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
9c5eb1f
%endif
9c5eb1f
71f464f
%global pylib_version 1.4.17
16bbfe7
9c5eb1f
Name:           pytest
71f464f
Version:        2.4.2
71f464f
Release:        1%{?dist}
9c5eb1f
Summary:        Simple powerful testing with Python
9c5eb1f
9c5eb1f
Group:          Development/Languages
9c5eb1f
License:        MIT
9c5eb1f
URL:            http://pytest.org
6e12e2a
Source0:        http://pypi.python.org/packages/source/p/%{name}/%{name}-%{version}.tar.gz
9c5eb1f
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
9c5eb1f
9c5eb1f
BuildArch:      noarch
9c5eb1f
BuildRequires:  python-devel
9c5eb1f
BuildRequires:  python-setuptools
cc8ea75
Requires:       python-setuptools
16bbfe7
BuildRequires:  python-py >= %{pylib_version}
16bbfe7
Requires:       python-py >= %{pylib_version}
0560a6d
%if 0%{?rhel} > 6 || 0%{?fedora}
9c5eb1f
BuildRequires:  python-sphinx
8205b3a
%else
8205b3a
BuildRequires:  python-sphinx10
8205b3a
%endif # fedora
0b8017b
BuildRequires:  python-docutils
9c5eb1f
%if 0%{?with_python3}
9c5eb1f
BuildRequires:  python3-devel
9c5eb1f
BuildRequires:  python3-setuptools
16bbfe7
BuildRequires:  python3-py >= %{pylib_version}
9c5eb1f
%endif # with_python3
9c5eb1f
# pytest was separated from pylib at that point
9c5eb1f
Conflicts:      python-py < 1.4.0
9c5eb1f
3bf32da
# used by the testsuite, if present:
3bf32da
%if 0%{?fedora}
ea6a47f
# if pexpect is present, the testsuite fails on F19 due to
ea6a47f
# http://bugs.python.org/issue17998
ea6a47f
#BuildRequires:  python-pexpect
3bf32da
BuildRequires:  python-mock
5c13630
BuildRequires:  python-twisted-core
3bf32da
%if 0%{?with_python3}
ea6a47f
#BuildRequires:  python3-pexpect
3bf32da
BuildRequires:  python3-mock
3bf32da
%endif # with_python3
3bf32da
%endif # fedora
3bf32da
3bf32da
9c5eb1f
%description
9c5eb1f
py.test provides simple, yet powerful testing for Python.
9c5eb1f
9c5eb1f
9c5eb1f
%if 0%{?with_python3}
9c5eb1f
%package -n python3-pytest
9c5eb1f
Summary:        Simple powerful testing with Python
9c5eb1f
Group:          Development/Languages
5cb33d7
Requires:       python3-setuptools
16bbfe7
Requires:       python3-py >= %{pylib_version}
9c5eb1f
9c5eb1f
9c5eb1f
%description -n python3-pytest
9c5eb1f
py.test provides simple, yet powerful testing for Python.
9c5eb1f
%endif # with_python3
9c5eb1f
9c5eb1f
9c5eb1f
%prep
9c5eb1f
%setup -q
9c5eb1f
9c5eb1f
%if 0%{?with_python3}
9c5eb1f
cp -a . %{py3dir}
9c5eb1f
%endif # with_python3
9c5eb1f
9c5eb1f
9c5eb1f
%build
9c5eb1f
%{__python} setup.py build
9c5eb1f
0560a6d
%if 0%{?rhel} > 6 || 0%{?fedora}
e5fa0a8
for l in doc/* ; do
e5fa0a8
  make -C $l html PYTHONPATH=$(pwd)
e5fa0a8
done
8205b3a
%else
e5fa0a8
for l in doc/* ; do
e5fa0a8
  make -C $l html SPHINXBUILD=sphinx-1.0-build PYTHONPATH=$(pwd)
e5fa0a8
done
8205b3a
%endif # fedora
9c5eb1f
9c5eb1f
%if 0%{?with_python3}
9c5eb1f
pushd %{py3dir}
9c5eb1f
%{__python3} setup.py build
9c5eb1f
popd
9c5eb1f
%endif # with_python3
9c5eb1f
9c5eb1f
9c5eb1f
%install
9c5eb1f
rm -rf %{buildroot}
9c5eb1f
%{__python} setup.py install -O1 --skip-build --root %{buildroot}
9c5eb1f
9c5eb1f
# remove shebangs from all scripts
9c5eb1f
find %{buildroot}%{python_sitelib} -name '*.py' \
9c5eb1f
     -exec sed -i -e '1{/^#!/d}' {} \;
9c5eb1f
9c5eb1f
%if 0%{?with_python3}
9c5eb1f
pushd %{py3dir}
9c5eb1f
%{__python3} setup.py install -O1 --skip-build --root %{buildroot}
9c5eb1f
9c5eb1f
# remove shebangs from all scripts
9c5eb1f
find %{buildroot}%{python3_sitelib} -name '*.py' \
9c5eb1f
     -exec sed -i -e '1{/^#!/d}' {} \;
9c5eb1f
9c5eb1f
popd
9c5eb1f
%endif # with_python3
9c5eb1f
e5fa0a8
mkdir -p _htmldocs/html
e5fa0a8
for l in doc/* ; do
e5fa0a8
  # remove hidden file
e5fa0a8
  rm ${l}/_build/html/.buildinfo
e5fa0a8
  mv ${l}/_build/html _htmldocs/html/${l##doc/}
e5fa0a8
done
9c5eb1f
0b8017b
rst2html README.rst > README.html
0b8017b
9c5eb1f
# use 2.X per default
9c5eb1f
pushd %{buildroot}%{_bindir}
9c5eb1f
ln -snf py.test-2.* py.test
9c5eb1f
popd
9c5eb1f
9c5eb1f
9c5eb1f
%clean
9c5eb1f
rm -rf %{buildroot}
9c5eb1f
9c5eb1f
9c5eb1f
%check
71f464f
PATH=%{buildroot}%{_bindir}:${PATH} \
9c5eb1f
PYTHONPATH=%{buildroot}%{python_sitelib} \
388c87f
  %{buildroot}%{_bindir}/py.test -r s
9c5eb1f
%if 0%{?with_python3}
9c5eb1f
pushd %{py3dir}
71f464f
PATH=%{buildroot}%{_bindir}:${PATH} \
9c5eb1f
PYTHONPATH=%{buildroot}%{python3_sitelib} \
388c87f
  %{buildroot}%{_bindir}/py.test-3.* -r s
9c5eb1f
popd
9c5eb1f
%endif # with_python3
9c5eb1f
9c5eb1f
9c5eb1f
%files
9c5eb1f
%defattr(-,root,root,-)
0b8017b
%doc CHANGELOG LICENSE README.html
e5fa0a8
%doc _htmldocs/html
9c5eb1f
%{_bindir}/py.test
9c5eb1f
%{_bindir}/py.test-2.*
9c5eb1f
%{python_sitelib}/*
9c5eb1f
9c5eb1f
9c5eb1f
%if 0%{?with_python3}
9c5eb1f
%files -n python3-pytest
9c5eb1f
%defattr(-,root,root,-)
0b8017b
%doc CHANGELOG LICENSE README.html
e5fa0a8
%doc _htmldocs/html
9c5eb1f
%{_bindir}/py.test-3.*
9c5eb1f
%{python3_sitelib}/*
9c5eb1f
%endif # with_python3
9c5eb1f
9c5eb1f
9c5eb1f
%changelog
71f464f
* Sat Oct  5 2013 Thomas Moschny <thomas.moschny@gmx.de> - 2.4.2-1
71f464f
- Update to 2.4.2.
71f464f
- Add buildroot's bindir to PATH while running the testsuite.
71f464f
d9b4aea
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.3.5-4
d9b4aea
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
d9b4aea
ea6a47f
* Thu Jun 13 2013 Thomas Moschny <thomas.moschny@gmx.de> - 2.3.5-3
ea6a47f
- Disable tests using pexpect for now, fails on F19.
ea6a47f
5c13630
* Wed Jun 12 2013 Thomas Moschny <thomas.moschny@gmx.de> - 2.3.5-2
0560a6d
- Use python-sphinx for rhel > 6 (rhbz#973318).
5c13630
- Update BR to use python-pexpect instead of pexpect.
5c13630
6e12e2a
* Sat May 25 2013 Thomas Moschny <thomas.moschny@gmx.de> - 2.3.5-1
6e12e2a
- Update to 2.3.5.
0b8017b
- Docutils needed now to build README.html.
3bf32da
- Add some BR optionally used by the testsuite.
6e12e2a
73bee36
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.3.4-2
73bee36
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
73bee36
bb07fc2
* Fri Nov 23 2012 Thomas Moschny <thomas.moschny@gmx.de> - 2.3.4-1
bb07fc2
- Update to 2.3.4.
bb07fc2
388c87f
* Sun Oct 28 2012 Thomas Moschny <thomas.moschny@gmx.de> - 2.3.2-1
388c87f
- Update to 2.3.2.
388c87f
e5fa0a8
* Sun Oct 21 2012 Thomas Moschny <thomas.moschny@gmx.de> - 2.3.1-1
e5fa0a8
- Update to 2.3.1.
e5fa0a8
- Re-enable some tests, ignore others.
e5fa0a8
- Docs are available in English and Japanese now.
e5fa0a8
8205b3a
* Thu Oct 11 2012 Thomas Moschny <thomas.moschny@gmx.de> - 2.2.4-4
8205b3a
- Add conditional for sphinx on rhel.
8205b3a
- Remove rhel logic from with_python3 conditional.
8328a81
- Disable failing tests for Python3.
8205b3a
d1e937b
* Sat Aug 04 2012 David Malcolm <dmalcolm@redhat.com> - 2.2.4-3
d1e937b
- rebuild for https://fedoraproject.org/wiki/Features/Python_3.3
d1e937b
b3fe38d
* Sat Jul 21 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.2.4-2
b3fe38d
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
b3fe38d
16bbfe7
* Wed Jun  6 2012 Thomas Moschny <thomas.moschny@gmx.de> - 2.2.4-1
16bbfe7
- Update to 2.2.4.
16bbfe7
f908393
* Wed Feb  8 2012 Thomas Moschny <thomas.moschny@gmx.de> - 2.2.3-1
f908393
- Update to 2.2.3.
f908393
ea97d03
* Sat Jan 14 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.2.1-2
ea97d03
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
ea97d03
281bb38
* Sat Dec 17 2011 Thomas Moschny <thomas.moschny@gmx.de> - 2.2.1-1
281bb38
- Update to 2.2.1.
281bb38
96521b9
* Tue Dec 13 2011 Thomas Moschny <thomas.moschny@gmx.de> - 2.2.0-1
96521b9
- Update to 2.2.0.
96521b9
6c10783
* Wed Oct 26 2011 Thomas Moschny <thomas.moschny@gmx.de> - 2.1.3-1
6c10783
- Update to 2.1.3.
6c10783
6c10783
* Tue Sep 27 2011 Thomas Moschny <thomas.moschny@gmx.de> - 2.1.2-1
6c10783
- Update to 2.1.2.
6c10783
5cb33d7
* Sat Sep  3 2011 Thomas Moschny <thomas.moschny@gmx.de> - 2.1.1-2
5cb33d7
- Fix: python3 dependencies.
5cb33d7
fb76f74
* Sun Aug 28 2011 Thomas Moschny <thomas.moschny@gmx.de> - 2.1.1-1
fb76f74
- Update to 2.1.1.
fb76f74
cc8ea75
* Thu Aug 11 2011 Thomas Moschny <thomas.moschny@gmx.de> - 2.1.0-2
cc8ea75
- Update Requires and BuildRequires tags.
cc8ea75
9c5eb1f
* Tue Aug  9 2011 Thomas Moschny <thomas.moschny@gmx.de> - 2.1.0-1
9c5eb1f
- Update to 2.1.0.
9c5eb1f
9c5eb1f
* Mon May 30 2011 Thomas Moschny <thomas.moschny@gmx.de> - 2.0.3-1
9c5eb1f
- Update to 2.0.3.
9c5eb1f
9c5eb1f
* Thu Mar 17 2011 Thomas Moschny <thomas.moschny@gmx.de> - 2.0.2-1
9c5eb1f
- Update to 2.0.2.
9c5eb1f
9c5eb1f
* Sun Jan 16 2011 Thomas Moschny <thomas.moschny@gmx.de> - 2.0.0-1
9c5eb1f
- New package.