From 27607c9af469d8ab994d959e2dfdb69329e12b61 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Nov 02 2019 20:04:39 +0000 Subject: import python-nose-1.3.7-1.el7 --- diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2cb3a71 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/nose-1.3.7.tar.gz diff --git a/.python-nose.metadata b/.python-nose.metadata new file mode 100644 index 0000000..6e25e36 --- /dev/null +++ b/.python-nose.metadata @@ -0,0 +1 @@ +97f2a04c9d43b29ddf4794a1a1d1ba803f1074c6 SOURCES/nose-1.3.7.tar.gz diff --git a/SOURCES/python-nose-readunicode.patch b/SOURCES/python-nose-readunicode.patch new file mode 100644 index 0000000..61d4cd2 --- /dev/null +++ b/SOURCES/python-nose-readunicode.patch @@ -0,0 +1,20 @@ +diff -up nose-1.3.7/nose/plugins/doctests.py.readunicode nose-1.3.7/nose/plugins/doctests.py +--- nose-1.3.7/nose/plugins/doctests.py.readunicode 2015-04-04 02:52:52.000000000 -0600 ++++ nose-1.3.7/nose/plugins/doctests.py 2016-11-15 14:24:54.298239018 -0700 +@@ -49,6 +49,7 @@ test. + """ + from __future__ import generators + ++import codecs + import logging + import os + import sys +@@ -259,7 +260,7 @@ class Doctest(Plugin): + """ + if self.extension and anyp(filename.endswith, self.extension): + name = os.path.basename(filename) +- dh = open(filename) ++ dh = codecs.open(filename, encoding='utf-8') + try: + doc = dh.read() + finally: diff --git a/SOURCES/python-nose-unicode.patch b/SOURCES/python-nose-unicode.patch new file mode 100644 index 0000000..a103da8 --- /dev/null +++ b/SOURCES/python-nose-unicode.patch @@ -0,0 +1,128 @@ +diff -up nose-1.3.7/AUTHORS.unicode nose-1.3.7/AUTHORS +diff -up nose-1.3.7/CHANGELOG.unicode nose-1.3.7/CHANGELOG +diff -up nose-1.3.7/nose/plugins/capture.py.unicode nose-1.3.7/nose/plugins/capture.py +--- nose-1.3.7/nose/plugins/capture.py.unicode 2015-04-04 02:52:52.000000000 -0600 ++++ nose-1.3.7/nose/plugins/capture.py 2016-11-15 13:58:18.713025335 -0700 +@@ -12,6 +12,7 @@ the options ``-s`` or ``--nocapture``. + import logging + import os + import sys ++import traceback + from nose.plugins.base import Plugin + from nose.pyversion import exc_to_unicode, force_unicode + from nose.util import ln +@@ -71,26 +72,56 @@ class Capture(Plugin): + def formatError(self, test, err): + """Add captured output to error report. + """ +- test.capturedOutput = output = self.buffer ++ test.capturedOutput = output = '' ++ output_exc_info = None ++ try: ++ test.capturedOutput = output = self.buffer ++ except UnicodeError: ++ # python2's StringIO.StringIO [1] class has this warning: ++ # ++ # The StringIO object can accept either Unicode or 8-bit strings, ++ # but mixing the two may take some care. If both are used, 8-bit ++ # strings that cannot be interpreted as 7-bit ASCII (that use the ++ # 8th bit) will cause a UnicodeError to be raised when getvalue() ++ # is called. ++ # ++ # This exception handler is a protection against issue #816 [2]. ++ # Capturing the exception info allows us to display it back to the ++ # user. ++ # ++ # [1] ++ # [2] ++ output_exc_info = sys.exc_info() + self._buf = None +- if not output: ++ if (not output) and (not output_exc_info): + # Don't return None as that will prevent other + # formatters from formatting and remove earlier formatters + # formats, instead return the err we got + return err + ec, ev, tb = err +- return (ec, self.addCaptureToErr(ev, output), tb) ++ return (ec, self.addCaptureToErr(ev, output, output_exc_info=output_exc_info), tb) + + def formatFailure(self, test, err): + """Add captured output to failure report. + """ + return self.formatError(test, err) + +- def addCaptureToErr(self, ev, output): ++ def addCaptureToErr(self, ev, output, output_exc_info=None): ++ # If given, output_exc_info should be a 3-tuple from sys.exc_info(), ++ # from an exception raised while trying to get the captured output. + ev = exc_to_unicode(ev) + output = force_unicode(output) +- return u'\n'.join([ev, ln(u'>> begin captured stdout <<'), +- output, ln(u'>> end captured stdout <<')]) ++ error_text = [ev, ln(u'>> begin captured stdout <<'), ++ output, ln(u'>> end captured stdout <<')] ++ if output_exc_info: ++ error_text.extend([u'OUTPUT ERROR: Could not get captured output.', ++ # ++ # ++ u"The test might've printed both 'unicode' strings and non-ASCII 8-bit 'str' strings.", ++ ln(u'>> begin captured stdout exception traceback <<'), ++ u''.join(traceback.format_exception(*output_exc_info)), ++ ln(u'>> end captured stdout exception traceback <<')]) ++ return u'\n'.join(error_text) + + def start(self): + self.stdout.append(sys.stdout) +diff -up nose-1.3.7/unit_tests/test_capture_plugin.py.unicode nose-1.3.7/unit_tests/test_capture_plugin.py +--- nose-1.3.7/unit_tests/test_capture_plugin.py.unicode 2012-09-29 02:18:54.000000000 -0600 ++++ nose-1.3.7/unit_tests/test_capture_plugin.py 2016-11-15 13:58:18.714025330 -0700 +@@ -4,6 +4,12 @@ import unittest + from optparse import OptionParser + from nose.config import Config + from nose.plugins.capture import Capture ++from nose.pyversion import force_unicode ++ ++if sys.version_info[0] == 2: ++ py2 = True ++else: ++ py2 = False + + class TestCapturePlugin(unittest.TestCase): + +@@ -62,6 +68,35 @@ class TestCapturePlugin(unittest.TestCas + c.end() + self.assertEqual(c.buffer, "test 日本\n") + ++ def test_does_not_crash_with_mixed_unicode_and_nonascii_str(self): ++ class Dummy: ++ pass ++ d = Dummy() ++ c = Capture() ++ c.start() ++ printed_nonascii_str = force_unicode("test 日本").encode('utf-8') ++ printed_unicode = force_unicode("Hello") ++ print printed_nonascii_str ++ print printed_unicode ++ try: ++ raise Exception("boom") ++ except: ++ err = sys.exc_info() ++ formatted = c.formatError(d, err) ++ _, fev, _ = formatted ++ ++ if py2: ++ for string in [force_unicode(printed_nonascii_str, encoding='utf-8'), printed_unicode]: ++ assert string not in fev, "Output unexpectedly found in error message" ++ assert d.capturedOutput == '', "capturedOutput unexpectedly non-empty" ++ assert "OUTPUT ERROR" in fev ++ assert "captured stdout exception traceback" in fev ++ assert "UnicodeDecodeError" in fev ++ else: ++ for string in [repr(printed_nonascii_str), printed_unicode]: ++ assert string in fev, "Output not found in error message" ++ assert string in d.capturedOutput, "Output not attached to test" ++ + def test_format_error(self): + class Dummy: + pass diff --git a/SPECS/python-nose.spec b/SPECS/python-nose.spec new file mode 100644 index 0000000..1425e13 --- /dev/null +++ b/SPECS/python-nose.spec @@ -0,0 +1,338 @@ +%if 0%{?rhel} && 0%{?rhel} < 5 +%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} +%{!?python_version: %global python_version %(%{__python} -c "import sys ; print sys.version[:3]")} +%endif + +%{!?python3_version: %global python3_version %(%{__python3} -c "import sys; sys.stdout.write(sys.version[:3])")} + +%if 0%{?fedora} +%global with_python3 1 +%endif + + +%global upstream_name nose + +# Enable building without docs to avoid a circular dependency between this and python-sphinx +%global with_docs 1 + +Name: python-nose +Version: 1.3.7 +Release: 1%{?dist} +Summary: Discovery-based unittest extension for Python + +Group: Development/Languages +License: LGPLv2+ and Public Domain +URL: https://nose.readthedocs.org/en/latest/ +Source0: http://pypi.python.org/packages/source/n/nose/nose-%{version}.tar.gz +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) + +# Fix UnicodeDecodeError with captured output +# https://github.com/nose-devs/nose/pull/988 +Patch0: python-nose-unicode.patch +# Allow docutils to read utf-8 source +Patch1: python-nose-readunicode.patch + +BuildArch: noarch +BuildRequires: python2-devel +Provides: python2-%{upstream_name} = %{version}-%{release} +%if 0%{?with_python3} +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-coverage >= 3.4-1 +%endif +BuildRequires: python-setuptools +BuildRequires: dos2unix +BuildRequires: python-coverage >= 3.4-1 +Requires: python-setuptools + +%description +nose extends the test loading and running features of unittest, making +it easier to write, find and run tests. + +By default, nose will run tests in files or directories under the +current working directory whose names include "test" or "Test" at a +word boundary (like "test_this" or "functional_test" or "TestClass" +but not "libtest"). Test output is similar to that of unittest, but +also includes captured stdout output from failing tests, for easy +print-style debugging. + +These features, and many more, are customizable through the use of +plugins. Plugins included with nose provide support for doctest, code +coverage and profiling, flexible attribute-based test selection, +output capture and more. + +%package docs +Summary: Nose Documentation +Group: Documentation +%if 0%{?with_docs} +BuildRequires: python-sphinx +%endif +Provides: python2-nose-docs = %{version}-%{release} +Requires: python-nose = %{version}-%{release} + + +%description docs +Documentation for Nose + +%if 0%{?with_python3} +%package -n python3-%{upstream_name} +Summary: Discovery-based unittest extension for Python3 +Group: Development/Languages +Requires: python3-setuptools + +%description -n python3-%{upstream_name} +nose extends the test loading and running features of unittest, making +it easier to write, find and run tests. + +By default, nose will run tests in files or directories under the +current working directory whose names include "test" or "Test" at a +word boundary (like "test_this" or "functional_test" or "TestClass" +but not "libtest"). Test output is similar to that of unittest, but +also includes captured stdout output from failing tests, for easy +print-style debugging. + +These features, and many more, are customizable through the use of +plugins. Plugins included with nose provide support for doctest, code +coverage and profiling, flexible attribute-based test selection, +output capture and more. + +This package installs the nose module and nosetests3 program that can discover +python3 unittests. +%endif # with_python3 + +%prep +%setup -q -n %{upstream_name}-%{version} +%patch0 -p1 +%patch1 -p1 + +dos2unix examples/attrib_plugin.py + +%if 0%{?with_python3} +rm -rf %{py3dir} +cp -a . %{py3dir} +%endif # with_python3 + + +%build +%{__python2} setup.py build + +%if 0%{?with_python3} +pushd %{py3dir} +%{__python3} setup.py build +popd +%endif # with_python3 + +%install +rm -rf %{buildroot} +# Must do the python3 install first because the scripts in /usr/bin are +# overwritten with every setup.py install (and we want the python2 version +# to be the default for now). +%if 0%{?with_python3} +pushd %{py3dir} +%{__python3} setup.py install --skip-build --root %{buildroot} +rm %{buildroot}%{_bindir}/nosetests +mkdir -m 0755 -p %{buildroot}%{_mandir}/man1/ +mv %{buildroot}%{_prefix}/man/man1/nosetests.1 %{buildroot}%{_mandir}/man1/nosetests-%{python3_version}.1 +popd +%endif # with_python3 + +%{__python} setup.py install --skip-build --root %{buildroot} \ + --install-data=%{_datadir} + +%if 0%{?with_docs} +pushd doc +make html +rm -rf .build/html/.buildinfo .build/html/_sources +mv .build/html .. +rm -rf .build +popd +%endif # with_docs +cp -a doc reST +rm -rf reST/.static reST/.templates + + +%check +# Disable test_concurrent_shared as per rhbz#1176288 +mv functional_tests/test_multiprocessing/test_concurrent_shared.py{,.notest} +%{__python2} selftest.py + +%if 0%{?with_python3} +pushd %{py3dir} +export PYTHONPATH=`pwd`/build/lib +%{__python3} setup.py build_tests +# Various selftests fail with Python 3.3b1; skip them for now using "-e" +# (reported upstream as https://github.com/nose-devs/nose/issues/538 ) +%{__python3} selftest.py \ + -v +popd +%endif # with_python3 + +%clean +rm -rf %{buildroot} + + +%files +%defattr(-,root,root,-) +%doc AUTHORS CHANGELOG lgpl.txt NEWS README.txt +%{_bindir}/nosetests +%{_bindir}/nosetests-%{python_version} +%{_mandir}/man1/nosetests.1.gz +%{python_sitelib}/nose* + +%if 0%{?with_python3} +%files -n python3-%{upstream_name} +%defattr(-,root,root,-) +%doc AUTHORS CHANGELOG lgpl.txt NEWS README.txt +%{_bindir}/nosetests-%{python3_version} +%{_mandir}/man1/nosetests-%{python3_version}.1.gz +%{python3_sitelib}/nose* +%endif + +%files docs +%defattr(-,root,root,-) +%doc reST examples +%if 0%{?with_docs} +%doc html +%endif # with_docs + +%changelog +* Thu Oct 13 2016 Charalampos Stratakis - 1.3.7-1 +- Update to nose 1.3.7 +Resolves: rhbz#1377093 + +* Tue Jan 06 2015 Slavek Kabrda - 1.3.0-3 +- Disable unstable multiprocessing test. +Resolves: rhbz#1176288 + +* Fri Dec 27 2013 Daniel Mach - 1.3.0-2 +- Mass rebuild 2013-12-27 + +* Tue Apr 9 2013 Toshio Kuratomi - 1.3.0-1 +- Update to 1.3.0 upstream with python-3.3 fixes + +* Thu Feb 14 2013 Fedora Release Engineering - 1.2.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Wed Sep 12 2012 Toshio Kuratomi - 1.2.1-1 +- New upsream 1.2.1 that just bumps the version properly + +* Mon Sep 10 2012 Toshio Kuratomi - 1.2.0-1 +- Update to nose-1.2.0. +- Two less python3 test failures than 1.1.2 + +* Sat Aug 4 2012 David Malcolm - 1.1.2-5 +- rebuild for https://fedoraproject.org/wiki/Features/Python_3.3 +- disable selftests that fail under 3.3 + +* Fri Aug 3 2012 David Malcolm - 1.1.2-4 +- remove rhel logic from with_python3 conditional + +* Sat Jul 21 2012 Fedora Release Engineering - 1.1.2-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Sat Jan 14 2012 Fedora Release Engineering - 1.1.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Mon Aug 1 2011 Toshio Kuratomi - 1.1.2-1 +- Upstream bugfix release + +* Wed Jul 27 2011 Toshio Kuratomi - 1.1.1-1 +- Upstream bugfix release + +* Tue Feb 08 2011 Fedora Release Engineering - 1.0.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Sun Dec 26 2010 Toshio Kuratomi - 1.0.0-1 +- Update to 1.0.0 +- Create the docs subpackage for text docs even if we don't create the html docs. +- Make python3 subpackage + +* Tue Dec 7 2010 Toshio Kuratomi - 0.11.4-2 +- Fix FTBFS with newer coverage + +* Thu Oct 21 2010 Luke Macken - 0.11.4-1 +- Update to 0.11.4 (#3630722) + +* Wed Jul 21 2010 David Malcolm - 0.11.3-5 +- add support for building without docs, to avoid a circular build-time +dependency between this and python-sphinx; disable docs subpackage for now +- add (apparently) missing BR on python-coverage (appears to be needed +for %%check) +- cherrypick upstream compatibility fixes for 2.7 + +* Wed Jul 21 2010 David Malcolm - 0.11.3-4 +- Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild + +* Thu May 20 2010 Luke Macken - 0.11.3-3 +- Update URL to http://code.google.com/p/python-nose/ +- Align description to reflect that in setup.py +- Create a docs subpackage containing HTML & reST documentation +- Thanks to Gareth Armstrong at HP for the patch + +* Thu May 06 2010 Luke Macken - 0.11.3-2 +- Don't hardcode the python version + +* Thu May 06 2010 Luke Macken - 0.11.3-1 +- Update to 0.11.3 +- Enable the self tests + +* Mon Oct 05 2009 Luke Macken - 0.11.1-2 +- Include the new nosetests-2.6 script as well + +* Mon Oct 05 2009 Luke Macken - 0.11.1-1 +- Update to 0.11.1 + +* Sun Jul 26 2009 Fedora Release Engineering - 0.10.4-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Thu Feb 26 2009 Fedora Release Engineering - 0.10.4-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + +* Sat Nov 29 2008 Ignacio Vazquez-Abrams - 0.10.4-1 +- Update to 0.10.4 to fix 2.6 issues + +* Sat Nov 29 2008 Ignacio Vazquez-Abrams - 0.10.3-2 +- Rebuild for Python 2.6 + +* Sat Aug 02 2008 Luke Macken 0.10.3-1 +- Update to 0.10.3 + +* Thu Feb 28 2008 Luke Macken 0.10.1-1 +- Update to 0.10.1 + +* Mon Dec 3 2007 Luke Macken 0.10.0-2 +- Add python-setuptools to Requires (Bug #408491) + +* Tue Nov 27 2007 Luke Macken 0.10.0-1 +- 0.10.0 + +* Sun Sep 2 2007 Luke Macken 0.10.0-0.3.b1 +- Update for python-setuptools changes in rawhide + +* Tue Aug 21 2007 Luke Macken 0.10.0-0.2.b1 +- 0.10.0b1 +- Update license tag to LGPLv2 + +* Fri Jun 20 2007 Luke Macken 0.10.0-0.1.a2 +- 0.10.0a2 + +* Sat Jun 2 2007 Luke Macken 0.9.3-1 +- Latest upstream release +- Remove python-nose-0.9.2-mandir.patch + +* Sat Mar 3 2007 Luke Macken 0.9.2-1 +- Add nosetests(1) manpage, and python-nose-0.9.2-mandir.patch to put it in + the correct location. +- 0.9.2 + +* Sat Dec 9 2006 Luke Macken 0.9.1-2 +- Rebuild for python 2.5 + +* Fri Nov 24 2006 Luke Macken 0.9.1-1 +- 0.9.1 + +* Fri Sep 8 2006 Luke Macken 0.9.0-1 +- 0.9.0 + +* Wed Apr 19 2006 Ignacio Vazquez-Abrams 0.8.7.2-1 +- Initial RPM release