[packages/python-subunit] - updated to 1.3.0 - added tests patch (unit tests adjustments, don't require unittest2 on python 3.

qboosh qboosh at pld-linux.org
Sun Jul 29 17:16:43 CEST 2018


commit cb33cc3847e59383b6669c7bbece6e3fb0773c37
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Sun Jul 29 17:18:45 2018 +0200

    - updated to 1.3.0
    - added tests patch (unit tests adjustments, don't require unittest2 on python 3.5+)

 python-subunit-tests.patch | 62 ++++++++++++++++++++++++++++++++++++++++++++++
 python-subunit.spec        | 42 ++++++++++++++++++++-----------
 2 files changed, 90 insertions(+), 14 deletions(-)
---
diff --git a/python-subunit.spec b/python-subunit.spec
index 930f452..1aaecc8 100644
--- a/python-subunit.spec
+++ b/python-subunit.spec
@@ -2,20 +2,20 @@
 # Conditional build:
 %bcond_without	python2 # CPython 2.x module and tools
 %bcond_without	python3 # CPython 3.x module and tools
-%bcond_without	tests	# test target
+%bcond_without	tests	# unit tests
 
-%define 	module	template
 Summary:	subunit - streaming protocol for test results
 Summary(pl.UTF-8):	subunit - protokół strumieniowy do wyników testów
 Name:		python-subunit
-Version:	1.2.0
-Release:	4
+Version:	1.3.0
+Release:	1
 License:	Apache v2.0 or BSD
 Group:		Libraries/Python
-#Source0Download: https://pypi.python.org/simple/python-subunit/
-Source0:	https://pypi.python.org/packages/source/p/python-subunit/%{name}-%{version}.tar.gz
-# Source0-md5:	3305455dfe22e2b8666531909c026a2f
-URL:		https://pypi.python.org/pypi/python-subunit
+#Source0Download: https://pypi.org/simple/python-subunit/
+Source0:	https://files.pythonhosted.org/packages/source/p/python-subunit/%{name}-%{version}.tar.gz
+# Source0-md5:	16d468a3aeafe6c60a0c3b2b9132d65b
+Patch0:		%{name}-tests.patch
+URL:		https://pypi.org/project/python-subunit/
 BuildRequires:	rpm-pythonprov
 BuildRequires:	rpmbuild(macros) >= 1.714
 %if %{with python2}
@@ -26,6 +26,7 @@ BuildRequires:	python-testtools >= 0.9.34
 BuildRequires:	python-fixtures
 BuildRequires:	python-hypothesis
 BuildRequires:	python-testscenarios
+BuildRequires:	python-unittest2
 %endif
 %endif
 %if %{with python3}
@@ -36,11 +37,12 @@ BuildRequires:	python3-testtools >= 0.9.34
 BuildRequires:	python3-fixtures
 BuildRequires:	python3-hypothesis
 BuildRequires:	python3-testscenarios
+%if "%{py3_ver}" < "3.5"
+BuildRequires:	python3-unittest2
+%endif
 %endif
 %endif
-Requires:	python-extras
 Requires:	python-modules >= 1:2.6
-Requires:	python-testtools >= 0.9.34
 BuildArch:	noarch
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
@@ -84,9 +86,7 @@ subunit.
 Summary:	subunit - streaming protocol for test results
 Summary(pl.UTF-8):	subunit - protokół strumieniowy do wyników testów
 Group:		Libraries/Python
-Requires:	python3-extras
 Requires:	python3-modules >= 1:3.2
-Requires:	python3-testtools >= 0.9.34
 
 %description -n python3-subunit
 Subunit is a streaming protocol for test results.
@@ -113,14 +113,25 @@ subunit.
 
 %prep
 %setup -q
+%patch0 -p1
 
 %build
 %if %{with python2}
-%py_build %{?with_tests:test}
+%py_build
+
+%if %{with tests}
+PYTHONPATH=$(pwd)/python \
+%{__python} -m subunit.run subunit.tests.test_suite | PYTHONPATH=$(pwd)/python %{__python} filters/subunit2pyunit
+%endif
 %endif
 
 %if %{with python3}
-%py3_build %{?with_tests:test}
+%py3_build
+
+%if %{with tests}
+PYTHONPATH=$(pwd)/python \
+%{__python3} -m subunit.run subunit.tests.test_suite | PYTHONPATH=$(pwd)/python %{__python3} filters/subunit2pyunit
+%endif
 %endif
 
 %install
@@ -169,6 +180,7 @@ rm -rf $RPM_BUILD_ROOT
 %attr(755,root,root) %{_bindir}/subunit-stats
 %attr(755,root,root) %{_bindir}/subunit-tags
 %attr(755,root,root) %{_bindir}/subunit2csv
+%attr(755,root,root) %{_bindir}/subunit2disk
 %attr(755,root,root) %{_bindir}/subunit2gtk
 %attr(755,root,root) %{_bindir}/subunit2junitxml
 %attr(755,root,root) %{_bindir}/subunit2pyunit
@@ -185,6 +197,7 @@ rm -rf $RPM_BUILD_ROOT
 %attr(755,root,root) %{_bindir}/subunit-stats-2
 %attr(755,root,root) %{_bindir}/subunit-tags-2
 %attr(755,root,root) %{_bindir}/subunit2csv-2
+%attr(755,root,root) %{_bindir}/subunit2disk-2
 %attr(755,root,root) %{_bindir}/subunit2gtk-2
 %attr(755,root,root) %{_bindir}/subunit2junitxml-2
 %attr(755,root,root) %{_bindir}/subunit2pyunit-2
@@ -209,6 +222,7 @@ rm -rf $RPM_BUILD_ROOT
 %attr(755,root,root) %{_bindir}/subunit-stats-3
 %attr(755,root,root) %{_bindir}/subunit-tags-3
 %attr(755,root,root) %{_bindir}/subunit2csv-3
+%attr(755,root,root) %{_bindir}/subunit2disk-3
 %attr(755,root,root) %{_bindir}/subunit2gtk-3
 %attr(755,root,root) %{_bindir}/subunit2junitxml-3
 %attr(755,root,root) %{_bindir}/subunit2pyunit-3
diff --git a/python-subunit-tests.patch b/python-subunit-tests.patch
new file mode 100644
index 0000000..094d4d3
--- /dev/null
+++ b/python-subunit-tests.patch
@@ -0,0 +1,62 @@
+Disable test_test_protocol2, which depends on testtools own test suite.
+Don't require unittest2 on python 3.5+.
+Adjust some traceback quirks for (python3 or not unittest2???)
+
+--- python-subunit-1.3.0/python/subunit/tests/__init__.py.orig	2018-07-27 17:10:42.361296016 +0200
++++ python-subunit-1.3.0/python/subunit/tests/__init__.py	2018-07-27 17:10:56.404629189 +0200
+@@ -40,7 +40,6 @@
+     test_subunit_tags,
+     test_tap2subunit,
+     test_test_protocol,
+-    test_test_protocol2,
+     test_test_results,
+     )
+ 
+@@ -53,7 +52,6 @@
+     result.addTest(loader.loadTestsFromModule(test_progress_model))
+     result.addTest(loader.loadTestsFromModule(test_test_results))
+     result.addTest(loader.loadTestsFromModule(test_test_protocol))
+-    result.addTest(loader.loadTestsFromModule(test_test_protocol2))
+     result.addTest(loader.loadTestsFromModule(test_tap2subunit))
+     result.addTest(loader.loadTestsFromModule(test_filter_to_disk))
+     result.addTest(loader.loadTestsFromModule(test_subunit_filter))
+--- python-subunit-1.3.0/python/subunit/tests/test_test_protocol.py.orig	2018-07-27 17:16:40.051291931 +0200
++++ python-subunit-1.3.0/python/subunit/tests/test_test_protocol.py	2018-07-27 17:16:42.897958565 +0200
+@@ -16,7 +16,10 @@
+ 
+ import datetime
+ import io
+-import unittest2 as unittest
++try:
++    import unittest2 as unittest
++except ImportError:
++    import unittest
+ import os
+ import sys
+ import tempfile
+--- python-subunit-1.3.0/python/subunit/tests/__init__.py.orig	2018-07-27 18:09:57.424588755 +0200
++++ python-subunit-1.3.0/python/subunit/tests/__init__.py	2018-07-29 12:02:31.736200742 +0200
+@@ -22,9 +22,10 @@
+ 
+ # Before the test module imports to avoid circularity.
+ # For testing: different pythons have different str() implementations.
++tb_prelude = "Traceback (most recent call last):\n" if sys.version_info[0] < 3 else ""
+ _remote_exception_repr = "testtools.testresult.real._StringException"
+-_remote_exception_str = "Traceback (most recent call last):\ntesttools.testresult.real._StringException"
+-_remote_exception_str_chunked = "57\r\n" + _remote_exception_str + ": boo qux\n0\r\n"
++_remote_exception_str = tb_prelude + "testtools.testresult.real._StringException"
++_remote_exception_str_chunked = ("%X" % (42+10+len(tb_prelude)) + "\r\n" + _remote_exception_str + ": boo qux\n0\r\n"
+ 
+ 
+ from subunit.tests import (
+--- python-subunit-1.3.0/python/subunit/tests/test_test_protocol.py.orig	2018-07-29 12:02:58.076200443 +0200
++++ python-subunit-1.3.0/python/subunit/tests/test_test_protocol.py	2018-07-29 12:03:04.769533698 +0200
+@@ -51,7 +51,7 @@
+ import subunit.iso8601 as iso8601
+ 
+ 
+-tb_prelude = "Traceback (most recent call last):\n" 
++from subunit.tests import tb_prelude   # tb_prelude = "Traceback (most recent call last):\n" if sys.version_info[0] < 3 else ""
+ 
+ 
+ def details_to_str(details):
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/python-subunit.git/commitdiff/cb33cc3847e59383b6669c7bbece6e3fb0773c37



More information about the pld-cvs-commit mailing list