Package: subunit
Severity: normal
Version: 0.0.8+bzr176-1
User: debian-pyt...@lists.debian.org
Usertags: python3.3
Tags: patch

Python3.3 has python seed hash randomisation enabled by default.
Please consider applying the below patch.

The running testsuite with different hashes may be a bit excessive, but
helped a lot to find the failures, while developing the patch.

diff -Nru subunit-0.0.8+bzr176/debian/changelog subunit-0.0.8+bzr176/debian/changelog
--- subunit-0.0.8+bzr176/debian/changelog	2012-05-24 14:14:37.000000000 +0100
+++ subunit-0.0.8+bzr176/debian/changelog	2012-10-31 09:29:46.000000000 +0000
@@ -1,3 +1,12 @@
+subunit (0.0.8+bzr176-1.1) UNRELEASED; urgency=low
+
+  * Sort remaining iterators over dictionary keys.
+  * Execute python test-suite multiple times with different hash seeds.
+  * Use OrderedDict in test-suite to prevent hash randomisation failing
+    test suites. (LP: #1025392)
+
+ -- Dmitrijs Ledkovs <dmitrij.led...@ubuntu.com>  Fri, 26 Oct 2012 18:56:25 +0100
+
 subunit (0.0.8+bzr176-1) unstable; urgency=low
 
   * New upstream snapshot.
diff -Nru subunit-0.0.8+bzr176/debian/patches/fix-ftbfs-python3.3.patch subunit-0.0.8+bzr176/debian/patches/fix-ftbfs-python3.3.patch
--- subunit-0.0.8+bzr176/debian/patches/fix-ftbfs-python3.3.patch	1970-01-01 01:00:00.000000000 +0100
+++ subunit-0.0.8+bzr176/debian/patches/fix-ftbfs-python3.3.patch	2012-10-31 08:39:00.000000000 +0000
@@ -0,0 +1,64 @@
+Description: Use or expect ordered results, fixes FTBFS with python3.3's order randomisation.
+Origin: commit, revision id: dmitrijs.ledk...@canonical.com-20121030225129-kl5wnq22orvt7338
+Author: Dmitrijs Ledkovs <dmitrijs.ledk...@canonical.com>
+Bug: https://launchpad.net/bugs/1025392
+Last-Update: 2012-10-30
+X-Bzr-Revision-Id: dmitrijs.ledk...@canonical.com-20121030225129-kl5wnq22orvt7338
+
+=== modified file 'python/subunit/__init__.py'
+--- old/python/subunit/__init__.py	2012-05-07 22:19:16 +0000
++++ new/python/subunit/__init__.py	2012-10-30 22:51:29 +0000
+@@ -772,7 +772,7 @@
+             return
+         tags = set([tag.encode('utf8') for tag in new_tags])
+         tags.update([_b("-") + tag.encode('utf8') for tag in gone_tags])
+-        tag_line = _b("tags: ") + _b(" ").join(tags) + _b("\n")
++        tag_line = _b("tags: ") + _b(" ").join(sorted(tags)) + _b("\n")
+         self._stream.write(tag_line)
+ 
+     def time(self, a_datetime):
+@@ -798,7 +798,7 @@
+             if parameters:
+                 self._stream.write(_b(";"))
+                 param_strs = []
+-                for param, value in parameters.items():
++                for param, value in sorted(parameters.items()):
+                     param_strs.append("%s=%s" % (param, value))
+                 self._stream.write(_b(",".join(param_strs)))
+             self._stream.write(_b("\n%s\n" % name))
+
+=== modified file 'python/subunit/tests/test_test_protocol.py'
+--- old/python/subunit/tests/test_test_protocol.py	2012-03-25 14:38:54 +0000
++++ new/python/subunit/tests/test_test_protocol.py	2012-10-30 22:51:29 +0000
+@@ -14,6 +14,7 @@
+ #  limitations under that license.
+ #
+ 
++from collections import OrderedDict
+ import datetime
+ import unittest
+ import os
+@@ -1134,9 +1135,10 @@
+         self.io = BytesIO()
+         self.protocol = subunit.TestProtocolClient(self.io)
+         self.test = TestTestProtocolClient("test_start_test")
+-        self.sample_details = {'something':Content(
+-            ContentType('text', 'plain'), lambda:[_b('serialised\nform')])}
+-        self.sample_tb_details = dict(self.sample_details)
++        self.sample_details = OrderedDict([
++            ('something', Content(ContentType('text', 'plain'),
++                                  lambda:[_b('serialised\nform')]))])
++        self.sample_tb_details = OrderedDict(self.sample_details)
+         self.sample_tb_details['traceback'] = TracebackContent(
+             subunit.RemoteError(_u("boo qux")), self.test)
+ 
+@@ -1311,7 +1313,7 @@
+ 
+     def test_tags_both(self):
+         self.protocol.tags(set(['quux']), set(['bar']))
+-        self.assertEqual(_b("tags: quux -bar\n"), self.io.getvalue())
++        self.assertEqual(_b("tags: -bar quux\n"), self.io.getvalue())
+ 
+     def test_tags_gone(self):
+         self.protocol.tags(set(), set(['bar']))
+
diff -Nru subunit-0.0.8+bzr176/debian/patches/series subunit-0.0.8+bzr176/debian/patches/series
--- subunit-0.0.8+bzr176/debian/patches/series	1970-01-01 01:00:00.000000000 +0100
+++ subunit-0.0.8+bzr176/debian/patches/series	2012-10-27 13:19:02.000000000 +0100
@@ -0,0 +1 @@
+fix-ftbfs-python3.3.patch
diff -Nru subunit-0.0.8+bzr176/debian/rules subunit-0.0.8+bzr176/debian/rules
--- subunit-0.0.8+bzr176/debian/rules	2012-03-13 09:11:59.000000000 +0000
+++ subunit-0.0.8+bzr176/debian/rules	2012-10-31 09:34:02.000000000 +0000
@@ -12,9 +12,19 @@
 
 override_dh_auto_clean:
 	$(MAKE) distclean || true
+	find . -name '*.pyc' -delete
+	find . -name '__pycache__' -delete 
 	rm -rf build
 	rm -f configure
 
+override_dh_auto_test:
+	dh_auto_test
+	set -ex; for i in random `seq 10`; do \
+            for vers in $(PY3VERS); do \
+		SHELL_SHARE='./shell/share/' PYTHONPATH=./python${PYTHONPATH:+:$PYTHONPATH} PYTHONHASHSEED=$$i python$$vers runtests.py; \
+	    done; \
+	done
+
 override_dh_auto_install:
 	$(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
 	find debian/tmp/ -name "*.pyc" | xargs rm -f
Regards,

Dmitrijs.

Reply via email to