subunit: Import new upstream snapshot.
authorJelmer Vernooij <jelmer@samba.org>
Sun, 13 Nov 2011 16:17:54 +0000 (17:17 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Sun, 13 Nov 2011 17:06:06 +0000 (18:06 +0100)
lib/subunit/NEWS
lib/subunit/configure.ac
lib/subunit/python/subunit/run.py
lib/subunit/python/subunit/tests/__init__.py
lib/subunit/python/subunit/tests/test_run.py [new file with mode: 0644]
lib/subunit/python/subunit/tests/test_test_protocol.py
lib/subunit/setup.py

index 2edf7369d9b7d53d32f1d430c32b80ac04664599..713d272bfaa9186cffc1b8e56096043d2f5adf54 100644 (file)
@@ -5,6 +5,26 @@ subunit release notes
 NEXT (In development)
 ---------------------
 
+IMPROVEMENTS
+~~~~~~~~~~~~
+
+* Perl module now correctly outputs "failure" instead of "fail".  (Stewart Smith)
+
+* Shell functions now output timestamps. (Stewart Smith)
+
+BUG FIXES
+~~~~~~~~~
+
+* Add 'subunit --no-xfail', which will omit expected failures from the subunit
+  stream. (John Arbash Meinel, #623642)
+
+* Add 'subunit -F/--only-genuine-failures' which sets all of '--no-skips',
+  '--no-xfail', '--no-passthrough, '--no-success', and gives you just the
+  failure stream. (John Arbash Meinel)
+
+0.0.7
+-----
+
 The Subunit Python test runner ``python -m subunit.run`` can now report the
 test ids and also filter via a test id list file thanks to improvements in
 ``testtools.run``. See the testtools manual, or testrepository - a major
@@ -26,13 +46,9 @@ IMPROVEMENTS
 * Force flush of writes to stdout in c/tests/test_child.
   (Jelmer Vernooij, #687611)
 
-* Perl module now correctly outputs "failure" instead of "fail".  (Stewart Smith)
-
 * Provisional Python 3.x support.
   (Robert Collins, Tres Seaver, Martin[gz], #666819)
 
-* Shell functions now output timestamps. (Stewart Smith)
-
 * ``subunit.chunked.Decoder`` Python class takes a new ``strict`` option,
   which defaults to ``True``. When ``False``, the ``Decoder`` will accept
   incorrect input that is still unambiguous. i.e. subunit will not barf if
@@ -68,20 +84,11 @@ IMPROVEMENTS
 * The Python2.7 / testtools addUnexpectedSuccess API is now supported. This
   required adding a new status code to the protocol. (Robert Collins, #654474)
 
-BUG FIXES
-~~~~~~~~~
-
-* Add 'subunit --no-xfail', which will omit expected failures from the subunit
-  stream. (John Arbash Meinel, #623642)
-
-* Add 'subunit -F/--only-genuine-failures' which sets all of '--no-skips',
-  '--no-xfail', '--no-passthrough, '--no-success', and gives you just the
-  failure stream. (John Arbash Meinel)
-
 CHANGES
 ~~~~~~~
 
-* Newer testtools is needed as part of the Python 3 support. (Robert Collins)
+* testtools 0.9.11 or newer is new needed (due to the Python 3 support).
+  (Robert Collins)
 
 0.0.6
 -----
index 569657346423a2072d727eefc06fbb4f50124a36..4375c379a3cbf0eb0ca4e9e8b8046e5b04c7b734 100644 (file)
@@ -1,6 +1,6 @@
 m4_define([SUBUNIT_MAJOR_VERSION], [0])
 m4_define([SUBUNIT_MINOR_VERSION], [0])
-m4_define([SUBUNIT_MICRO_VERSION], [6])
+m4_define([SUBUNIT_MICRO_VERSION], [7])
 m4_define([SUBUNIT_VERSION],
 m4_defn([SUBUNIT_MAJOR_VERSION]).m4_defn([SUBUNIT_MINOR_VERSION]).m4_defn([SUBUNIT_MICRO_VERSION]))
 AC_PREREQ([2.59])
index 51d6837aab71c9661b2ff7b8479a7b2eceb0a6e6..ca5fe5c17e0e4ac1506de39a3bae2a1fffe9af88 100755 (executable)
@@ -23,6 +23,7 @@
 import sys
 
 from subunit import TestProtocolClient, get_default_formatter
+from subunit.test_results import AutoTimingTestResultDecorator
 from testtools.run import (
     BUFFEROUTPUT,
     CATCHBREAK,
@@ -39,6 +40,7 @@ class SubunitTestRunner(object):
     def run(self, test):
         "Run the given test case or test suite."
         result = TestProtocolClient(self.stream)
+        result = AutoTimingTestResultDecorator(result)
         test(result)
         return result
 
index a78cec85722c81b366813ee9a99f6118feb304bb..e0e1eb1b040573f1152d33ac48964e40e2fc489c 100644 (file)
@@ -19,6 +19,7 @@ from subunit.tests import (
     test_chunked,
     test_details,
     test_progress_model,
+    test_run,
     test_subunit_filter,
     test_subunit_stats,
     test_subunit_tags,
@@ -38,4 +39,5 @@ def test_suite():
     result.addTest(test_subunit_filter.test_suite())
     result.addTest(test_subunit_tags.test_suite())
     result.addTest(test_subunit_stats.test_suite())
+    result.addTest(test_run.test_suite())
     return result
diff --git a/lib/subunit/python/subunit/tests/test_run.py b/lib/subunit/python/subunit/tests/test_run.py
new file mode 100644 (file)
index 0000000..5a96bcf
--- /dev/null
@@ -0,0 +1,52 @@
+#
+#  subunit: extensions to python unittest to get test results from subprocesses.
+#  Copyright (C) 2011  Robert Collins <robertc@robertcollins.net>
+#
+#  Licensed under either the Apache License, Version 2.0 or the BSD 3-clause
+#  license at the users choice. A copy of both licenses are available in the
+#  project source as Apache-2.0 and BSD. You may not use this file except in
+#  compliance with one of these two licences.
+#  
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under these licenses is distributed on an "AS IS" BASIS, WITHOUT
+#  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+#  license you chose for the specific language governing permissions and
+#  limitations under that license.
+#
+
+from cStringIO import StringIO
+import unittest
+
+from testtools import PlaceHolder
+
+import subunit
+from subunit.run import SubunitTestRunner
+
+
+def test_suite():
+    loader = subunit.tests.TestUtil.TestLoader()
+    result = loader.loadTestsFromName(__name__)
+    return result
+
+
+class TimeCollectingTestResult(unittest.TestResult):
+
+    def __init__(self, *args, **kwargs):
+        super(TimeCollectingTestResult, self).__init__(*args, **kwargs)
+        self.time_called = []
+
+    def time(self, a_time):
+        self.time_called.append(a_time)
+
+
+class TestSubunitTestRunner(unittest.TestCase):
+
+    def test_includes_timing_output(self):
+        io = StringIO()
+        runner = SubunitTestRunner(stream=io)
+        test = PlaceHolder('name')
+        runner.run(test)
+        client = TimeCollectingTestResult()
+        io.seek(0)
+        subunit.TestProtocolServer(client).readFrom(io)
+        self.assertTrue(len(client.time_called) > 0)
index 03d921abf11ab3871778a68b081a5a107d1da7b8..c93aabd80cdd25e5f9337a99c1ef05306c78c62b 100644 (file)
@@ -22,11 +22,18 @@ from testtools import skipIf, TestCase
 from testtools.compat import _b, _u, BytesIO, StringIO
 from testtools.content import Content, TracebackContent
 from testtools.content_type import ContentType
-from testtools.tests.helpers import (
-    Python26TestResult,
-    Python27TestResult,
-    ExtendedTestResult,
-    )
+try:
+    from testtools.testresult.doubles import (
+        Python26TestResult,
+        Python27TestResult,
+        ExtendedTestResult,
+        )
+except ImportError:
+    from testtools.tests.helpers import (
+        Python26TestResult,
+        Python27TestResult,
+        ExtendedTestResult,
+        )
 
 import subunit
 from subunit import _remote_exception_str, _remote_exception_str_chunked
index 2038d04826026d490b5e733b3414779339e83401..bb51a24fccc5607b12511dcc88586be8a38f2ad2 100755 (executable)
@@ -9,7 +9,7 @@ except ImportError:
 else:
     extra = {
         'install_requires': [
-            'testtools>=0.9.6',
+            'testtools>=0.9.11',
         ]
     }