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