Hello community,

here is the log from the commit of package python-python-subunit for 
openSUSE:Factory checked in at 2013-09-03 22:04:05
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-python-subunit (Old)
 and      /work/SRC/openSUSE:Factory/.python-python-subunit.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-python-subunit"

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/python-python-subunit/python-python-subunit.changes  
    2013-07-22 13:53:24.000000000 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-python-subunit.new/python-python-subunit.changes
 2013-09-03 22:04:06.000000000 +0200
@@ -1,0 +2,12 @@
+Tue Sep  3 08:22:49 UTC 2013 - [email protected]
+
+- update to 0.0.15:
+  * Clients of subunit did not expect memoryview objects in StreamResult 
events.
+  * Memoryview and struct were mutually incompatible in 2.7.3 and 3.2.
+  * Memoryview detection was broken and thus it's use was never really tested.
+  * TestProtocol2's tag tests were set sort order dependent.
+  * TestTestProtocols' test_tags_both was set sort order dependent.
+  * TestTestProtocols' test_*_details were dictionary sort order dependent.
+  * TestSubUnitTags's test_add_tag was also se sort order dependent.
+
+-------------------------------------------------------------------

Old:
----
  python-subunit-0.0.13.tar.gz

New:
----
  python-subunit-0.0.15.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-python-subunit.spec ++++++
--- /var/tmp/diff_new_pack.0vJ3rI/_old  2013-09-03 22:04:07.000000000 +0200
+++ /var/tmp/diff_new_pack.0vJ3rI/_new  2013-09-03 22:04:07.000000000 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           python-python-subunit
-Version:        0.0.13
+Version:        0.0.15
 Release:        0
 Summary:        Python implementation of subunit test streaming protocol
 License:        Apache-2.0 or BSD-3-Clause

++++++ python-subunit-0.0.13.tar.gz -> python-subunit-0.0.15.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-subunit-0.0.13/NEWS 
new/python-subunit-0.0.15/NEWS
--- old/python-subunit-0.0.13/NEWS      2013-06-16 22:02:45.000000000 +0200
+++ new/python-subunit-0.0.15/NEWS      2013-08-24 16:09:29.000000000 +0200
@@ -5,6 +5,39 @@
 NEXT (In development)
 ---------------------
 
+0.0.15
+------
+
+BUG FIXES
+~~~~~~~~~
+
+* Clients of subunit did not expect memoryview objects in StreamResult events.
+  (Robert Collins)
+
+* Memoryview and struct were mutually incompatible in 2.7.3 and 3.2.
+  (Robert Collins, #1216163)
+
+0.0.14
+------
+
+BUG FIXES
+~~~~~~~~~
+
+* Memoryview detection was broken and thus it's use was never really tested.
+  (Robert Collins, 1216101)
+
+* TestProtocol2's tag tests were set sort order dependent.
+  (Robert Collins, #1025392)
+
+* TestTestProtocols' test_tags_both was set sort order dependent.
+  (Robert Collins, #1025392)
+
+* TestTestProtocols' test_*_details were dictionary sort order dependent.
+  (Robert Collins, #1025392)
+
+* TestSubUnitTags's test_add_tag was also se sort order dependent.
+  (Robert Collins, #1025392)
+
 0.0.13
 ------
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-subunit-0.0.13/PKG-INFO 
new/python-subunit-0.0.15/PKG-INFO
--- old/python-subunit-0.0.13/PKG-INFO  2013-06-16 22:03:53.000000000 +0200
+++ new/python-subunit-0.0.15/PKG-INFO  2013-08-24 16:12:08.000000000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: python-subunit
-Version: 0.0.13
+Version: 0.0.15
 Summary: Python implementation of subunit test streaming protocol
 Home-page: http://launchpad.net/subunit
 Author: Robert Collins
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-subunit-0.0.13/python/subunit/__init__.py 
new/python-subunit-0.0.15/python/subunit/__init__.py
--- old/python-subunit-0.0.13/python/subunit/__init__.py        2013-06-16 
21:55:37.000000000 +0200
+++ new/python-subunit-0.0.15/python/subunit/__init__.py        2013-08-24 
16:08:44.000000000 +0200
@@ -160,7 +160,7 @@
 # If the releaselevel is 'final', then the tarball will be major.minor.micro.
 # Otherwise it is major.minor.micro~$(revno).
 
-__version__ = (0, 0, 13, 'final', 0)
+__version__ = (0, 0, 15, 'final', 0)
 
 PROGRESS_SET = 0
 PROGRESS_CUR = 1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/python-subunit-0.0.13/python/subunit/tests/test_subunit_tags.py 
new/python-subunit-0.0.15/python/subunit/tests/test_subunit_tags.py
--- old/python-subunit-0.0.13/python/subunit/tests/test_subunit_tags.py 
2013-06-16 11:58:51.000000000 +0200
+++ new/python-subunit-0.0.15/python/subunit/tests/test_subunit_tags.py 
2013-08-23 23:29:24.000000000 +0200
@@ -17,25 +17,46 @@
 """Tests for subunit.tag_stream."""
 
 from io import BytesIO
-import unittest
+
+import testtools
+from testtools.matchers import Contains
 
 import subunit
 import subunit.test_results
 
 
-class TestSubUnitTags(unittest.TestCase):
+class TestSubUnitTags(testtools.TestCase):
 
     def setUp(self):
+        super(TestSubUnitTags, self).setUp()
         self.original = BytesIO()
         self.filtered = BytesIO()
 
     def test_add_tag(self):
-        reference = BytesIO()
-        stream = subunit.StreamResultToBytes(reference)
-        stream.status(
-            test_id='test', test_status='inprogress', test_tags=set(['quux', 
'foo']))
-        stream.status(
-            test_id='test', test_status='success', test_tags=set(['bar', 
'quux', 'foo']))
+        # Literal values to avoid set sort-order dependencies. Python code show
+        # derivation.
+        # reference = BytesIO()
+        # stream = subunit.StreamResultToBytes(reference)
+        # stream.status(
+        #     test_id='test', test_status='inprogress', test_tags=set(['quux', 
'foo']))
+        # stream.status(
+        #     test_id='test', test_status='success', test_tags=set(['bar', 
'quux', 'foo']))
+        reference = [
+            b'\xb3)\x82\x17\x04test\x02\x04quux\x03foo\x05\x97n\x86\xb3)'
+                b'\x83\x1b\x04test\x03\x03bar\x04quux\x03fooqn\xab)',
+            b'\xb3)\x82\x17\x04test\x02\x04quux\x03foo\x05\x97n\x86\xb3)'
+                b'\x83\x1b\x04test\x03\x04quux\x03foo\x03bar\xaf\xbd\x9d\xd6',
+            b'\xb3)\x82\x17\x04test\x02\x04quux\x03foo\x05\x97n\x86\xb3)'
+                b'\x83\x1b\x04test\x03\x04quux\x03bar\x03foo\x03\x04b\r',
+            b'\xb3)\x82\x17\x04test\x02\x04quux\x03foo\x05\x97n\x86\xb3)'
+                b'\x83\x1b\x04test\x03\x03bar\x03foo\x04quux\xd2\x18\x1bC',
+            b'\xb3)\x82\x17\x04test\x02\x03foo\x04quux\xa6\xe1\xde\xec\xb3)'
+                b'\x83\x1b\x04test\x03\x03foo\x04quux\x03bar\x08\xc2X\x83',
+            b'\xb3)\x82\x17\x04test\x02\x03foo\x04quux\xa6\xe1\xde\xec\xb3)'
+                b'\x83\x1b\x04test\x03\x03bar\x03foo\x04quux\xd2\x18\x1bC',
+            b'\xb3)\x82\x17\x04test\x02\x03foo\x04quux\xa6\xe1\xde\xec\xb3)'
+                b'\x83\x1b\x04test\x03\x03foo\x03bar\x04quux:\x05e\x80',
+            ]
         stream = subunit.StreamResultToBytes(self.original)
         stream.status(
             test_id='test', test_status='inprogress', test_tags=set(['foo']))
@@ -44,7 +65,7 @@
         self.original.seek(0)
         self.assertEqual(
             0, subunit.tag_stream(self.original, self.filtered, ["quux"]))
-        self.assertEqual(reference.getvalue(), self.filtered.getvalue())
+        self.assertThat(reference, Contains(self.filtered.getvalue()))
 
     def test_remove_tag(self):
         reference = BytesIO()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/python-subunit-0.0.13/python/subunit/tests/test_test_protocol.py 
new/python-subunit-0.0.15/python/subunit/tests/test_test_protocol.py
--- old/python-subunit-0.0.13/python/subunit/tests/test_test_protocol.py        
2013-06-16 11:59:06.000000000 +0200
+++ new/python-subunit-0.0.15/python/subunit/tests/test_test_protocol.py        
2013-08-23 23:06:16.000000000 +0200
@@ -34,6 +34,7 @@
         Python27TestResult,
         ExtendedTestResult,
         )
+from testtools.matchers import Contains
 
 import subunit
 from subunit import _remote_exception_str, _remote_exception_str_chunked
@@ -1128,9 +1129,10 @@
         self.assertEqual(self.SampleTestToIsolate.TEST, False)
 
 
-class TestTestProtocolClient(unittest.TestCase):
+class TestTestProtocolClient(TestCase):
 
     def setUp(self):
+        super(TestTestProtocolClient, self).setUp()
         self.io = BytesIO()
         self.protocol = subunit.TestProtocolClient(self.io)
         self.unicode_test = PlaceHolder(_u('\u2603'))
@@ -1191,15 +1193,23 @@
         """Test addFailure on a TestProtocolClient with details."""
         self.protocol.addFailure(
             self.test, details=self.sample_tb_details)
-        self.assertEqual(
-            self.io.getvalue(),
+        self.assertThat([
             _b(("failure: %s [ multipart\n"
             "Content-Type: text/plain\n"
             "something\n"
             "F\r\nserialised\nform0\r\n"
             "Content-Type: text/x-traceback;charset=utf8,language=python\n"
             "traceback\n" + _remote_exception_str_chunked + ": boo qux\n0\r\n"
-            "]\n") % self.test.id()))
+            "]\n") % self.test.id()),
+            _b(("failure: %s [ multipart\n"
+            "Content-Type: text/plain\n"
+            "something\n"
+            "F\r\nserialised\nform0\r\n"
+            "Content-Type: text/x-traceback;language=python,charset=utf8\n"
+            "traceback\n" + _remote_exception_str_chunked + ": boo qux\n0\r\n"
+            "]\n") % self.test.id())
+            ],
+            Contains(self.io.getvalue())),
 
     def test_add_error(self):
         """Test stopTest on a TestProtocolClient."""
@@ -1215,15 +1225,23 @@
         """Test stopTest on a TestProtocolClient with details."""
         self.protocol.addError(
             self.test, details=self.sample_tb_details)
-        self.assertEqual(
-            self.io.getvalue(),
+        self.assertThat([
             _b(("error: %s [ multipart\n"
             "Content-Type: text/plain\n"
             "something\n"
             "F\r\nserialised\nform0\r\n"
             "Content-Type: text/x-traceback;charset=utf8,language=python\n"
             "traceback\n" + _remote_exception_str_chunked + ": boo qux\n0\r\n"
-            "]\n") % self.test.id()))
+            "]\n") % self.test.id()),
+            _b(("error: %s [ multipart\n"
+            "Content-Type: text/plain\n"
+            "something\n"
+            "F\r\nserialised\nform0\r\n"
+            "Content-Type: text/x-traceback;language=python,charset=utf8\n"
+            "traceback\n" + _remote_exception_str_chunked + ": boo qux\n0\r\n"
+            "]\n") % self.test.id()),
+            ],
+            Contains(self.io.getvalue())),
 
     def test_add_expected_failure(self):
         """Test addExpectedFailure on a TestProtocolClient."""
@@ -1239,16 +1257,23 @@
         """Test addExpectedFailure on a TestProtocolClient with details."""
         self.protocol.addExpectedFailure(
             self.test, details=self.sample_tb_details)
-        self.assertEqual(
-            self.io.getvalue(),
+        self.assertThat([
             _b(("xfail: %s [ multipart\n"
             "Content-Type: text/plain\n"
             "something\n"
             "F\r\nserialised\nform0\r\n"
             "Content-Type: text/x-traceback;charset=utf8,language=python\n"
             "traceback\n" + _remote_exception_str_chunked + ": boo qux\n0\r\n"
-            "]\n") % self.test.id()))
-
+            "]\n") % self.test.id()),
+            _b(("xfail: %s [ multipart\n"
+            "Content-Type: text/plain\n"
+            "something\n"
+            "F\r\nserialised\nform0\r\n"
+            "Content-Type: text/x-traceback;language=python,charset=utf8\n"
+            "traceback\n" + _remote_exception_str_chunked + ": boo qux\n0\r\n"
+            "]\n") % self.test.id()),
+            ],
+            Contains(self.io.getvalue())),
 
     def test_add_skip(self):
         """Test addSkip on a TestProtocolClient."""
@@ -1324,7 +1349,9 @@
 
     def test_tags_both(self):
         self.protocol.tags(set(['quux']), set(['bar']))
-        self.assertEqual(_b("tags: quux -bar\n"), self.io.getvalue())
+        self.assertThat(
+            [b"tags: quux -bar\n", b"tags: -bar quux\n"],
+            Contains(self.io.getvalue()))
 
     def test_tags_gone(self):
         self.protocol.tags(set(), set(['bar']))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/python-subunit-0.0.13/python/subunit/tests/test_test_protocol2.py 
new/python-subunit-0.0.15/python/subunit/tests/test_test_protocol2.py
--- old/python-subunit-0.0.13/python/subunit/tests/test_test_protocol2.py       
2013-06-16 11:59:01.000000000 +0200
+++ new/python-subunit-0.0.15/python/subunit/tests/test_test_protocol2.py       
2013-08-24 15:43:18.000000000 +0200
@@ -18,7 +18,7 @@
 import datetime
 
 from testtools import TestCase
-from testtools.matchers import HasLength
+from testtools.matchers import Contains, HasLength
 from testtools.tests.test_testresult import TestStreamResultContract
 from testtools.testresult.doubles import StreamResult
 
@@ -38,7 +38,10 @@
 CONSTANT_TIMESTAMP = b'\xb3+\x03\x13<\x17T\xcf\x80\xaf\xc8\x03barI\x96>-'
 CONSTANT_ROUTE_CODE = b'\xb3-\x03\x13\x03bar\x06source\x9cY9\x19'
 CONSTANT_RUNNABLE = b'\xb3(\x03\x0c\x03foo\xe3\xea\xf5\xa4'
-CONSTANT_TAGS = b'\xb3)\x80\x15\x03bar\x02\x03foo\x03barTHn\xb4'
+CONSTANT_TAGS = [
+    b'\xb3)\x80\x15\x03bar\x02\x03foo\x03barTHn\xb4',
+    b'\xb3)\x80\x15\x03bar\x02\x03bar\x03foo\xf8\xf1\x91o',
+    ]
 
 
 class TestStreamResultToBytesContract(TestCase, TestStreamResultContract):
@@ -202,7 +205,7 @@
     def test_tags(self):
         result, output = self._make_result()
         result.status(test_id="bar", test_tags=set(['foo', 'bar']))
-        self.assertEqual(CONSTANT_TAGS, output.getvalue())
+        self.assertThat(CONSTANT_TAGS, Contains(output.getvalue()))
 
     def test_timestamp(self):
         timestamp = datetime.datetime(2001, 12, 12, 12, 59, 59, 45,
@@ -300,6 +303,10 @@
             source, non_subunit_name="stdout").run(result)
         self.assertEqual(b'', source.read())
         self.assertEqual(events, result._events)
+        #- any file attachments should be byte contents [as users assume that].
+        for event in result._events:
+            if event[5] is not None:
+                self.assertIsInstance(event[6], bytes)
 
     def check_event(self, source_bytes, test_status=None, test_id="foo",
         route_code=None, timestamp=None, tags=None, mime_type=None,
@@ -357,7 +364,7 @@
             test_status='success', runnable=False)
 
     def test_tags(self):
-        self.check_event(CONSTANT_TAGS,
+        self.check_event(CONSTANT_TAGS[0],
             None, tags=set(['foo', 'bar']), test_id="bar")
 
     def test_timestamp(self):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-subunit-0.0.13/python/subunit/v2.py 
new/python-subunit-0.0.15/python/subunit/v2.py
--- old/python-subunit-0.0.13/python/subunit/v2.py      2013-05-13 
00:46:19.000000000 +0200
+++ new/python-subunit-0.0.15/python/subunit/v2.py      2013-08-24 
16:05:13.000000000 +0200
@@ -15,6 +15,7 @@
 #
 
 import codecs
+utf_8_decode = codecs.utf_8_decode
 import datetime
 from io import UnsupportedOperation
 import os
@@ -22,7 +23,8 @@
 import struct
 import zlib
 
-from extras import safe_hasattr
+from extras import safe_hasattr, try_imports
+builtins = try_imports(['__builtin__', 'builtins'])
 
 import subunit
 import subunit.iso8601 as iso8601
@@ -329,26 +331,35 @@
                 eof=True, file_name="Parser Error",
                 file_bytes=(error.args[0]).encode('utf8'))
 
+    def _to_bytes(self, data, pos, length):
+        """Return a slice of data from pos for length as bytes."""
+        # memoryview in 2.7.3 and 3.2 isn't directly usable with struct :(.
+        # see https://bugs.launchpad.net/subunit/+bug/1216163
+        result = data[pos:pos+length]
+        if type(result) is not bytes:
+            return result.tobytes()
+        return result
+
     def _parse_varint(self, data, pos, max_3_bytes=False):
         # because the only incremental IO we do is at the start, and the 32 bit
         # CRC means we can always safely read enough to cover any varint, we
         # can be sure that there should be enough data - and if not it is an
         # error not a normal situation.
-        data_0 = struct.unpack(FMT_8, data[pos:pos+1])[0]
+        data_0 = struct.unpack(FMT_8, self._to_bytes(data, pos, 1))[0]
         typeenum = data_0 & 0xc0
         value_0 = data_0 & 0x3f
         if typeenum == 0x00:
             return value_0, 1
         elif typeenum == 0x40:
-            data_1 = struct.unpack(FMT_8, data[pos+1:pos+2])[0]
+            data_1 = struct.unpack(FMT_8, self._to_bytes(data, pos+1, 1))[0]
             return (value_0 << 8) | data_1, 2
         elif typeenum == 0x80:
-            data_1 = struct.unpack(FMT_16, data[pos+1:pos+3])[0]
+            data_1 = struct.unpack(FMT_16, self._to_bytes(data, pos+1, 2))[0]
             return (value_0 << 16) | data_1, 3
         else:
             if max_3_bytes:
                 raise ParseError('3 byte maximum given but 4 byte value 
found.')
-            data_1, data_2 = struct.unpack(FMT_24, data[pos+1:pos+4])
+            data_1, data_2 = struct.unpack(FMT_24, self._to_bytes(data, pos+1, 
3))
             result = (value_0 << 24) | data_1 << 8 | data_2
             return result, 4
 
@@ -381,7 +392,7 @@
                 raise ParseError(
                     'Bad checksum - calculated (0x%x), stored (0x%x)'
                         % (crc, packet_crc))
-            if safe_hasattr(__builtins__, 'memoryview'):
+            if safe_hasattr(builtins, 'memoryview'):
                 body = memoryview(packet[-1])
             else:
                 body = packet[-1]
@@ -390,7 +401,7 @@
             # One packet could have both file and status data; the Python API
             # presents these separately (perhaps it shouldn't?)
             if flags & FLAG_TIMESTAMP:
-                seconds = struct.unpack(FMT_32, body[pos:pos+4])[0]
+                seconds = struct.unpack(FMT_32, self._to_bytes(body, pos, 
4))[0]
                 nanoseconds, consumed = self._parse_varint(body, pos+4)
                 pos = pos + 4 + consumed
                 timestamp = EPOCH + datetime.timedelta(
@@ -418,7 +429,7 @@
                 file_name, pos = self._read_utf8(body, pos)
                 content_length, consumed = self._parse_varint(body, pos)
                 pos += consumed
-                file_bytes = body[pos:pos+content_length]
+                file_bytes = self._to_bytes(body, pos, content_length)
                 if len(file_bytes) != content_length:
                     raise ParseError('File content extends past end of packet: 
'
                         'claimed %d bytes, %d available' % (
@@ -453,7 +464,12 @@
             raise ParseError('UTF8 string at offset %d contains NUL byte' % (
                 pos-2,))
         try:
-            return utf8_bytes.decode('utf-8'), length+pos
+            utf8, decoded_bytes = utf_8_decode(utf8_bytes)
+            if decoded_bytes != length:
+                raise ParseError("Invalid (partially decodable) string at "
+                    "offset %d, %d undecoded bytes" % (
+                    pos-2, length - decoded_bytes))
+            return utf8, length+pos
         except UnicodeDecodeError:
             raise ParseError('UTF8 string at offset %d is not UTF8' % (pos-2,))
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/python-subunit-0.0.13/python_subunit.egg-info/PKG-INFO 
new/python-subunit-0.0.15/python_subunit.egg-info/PKG-INFO
--- old/python-subunit-0.0.13/python_subunit.egg-info/PKG-INFO  2013-06-16 
22:03:53.000000000 +0200
+++ new/python-subunit-0.0.15/python_subunit.egg-info/PKG-INFO  2013-08-24 
16:12:07.000000000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: python-subunit
-Version: 0.0.13
+Version: 0.0.15
 Summary: Python implementation of subunit test streaming protocol
 Home-page: http://launchpad.net/subunit
 Author: Robert Collins
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-subunit-0.0.13/setup.cfg 
new/python-subunit-0.0.15/setup.cfg
--- old/python-subunit-0.0.13/setup.cfg 2013-06-16 22:03:53.000000000 +0200
+++ new/python-subunit-0.0.15/setup.cfg 2013-08-24 16:12:08.000000000 +0200
@@ -1,5 +1,5 @@
 [egg_info]
+tag_build = 
 tag_date = 0
 tag_svn_revision = 0
-tag_build = 
 

-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to