From 91438920b465ec7455dd1cd700bbe8ec5050b3f9 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 9 Dec 2010 14:51:51 +0100 Subject: [PATCH] subunit: Update to newer upstream snapshot. --- lib/subunit/INSTALL | 9 ++++++++- lib/subunit/NEWS | 17 +++++++++++++++++ lib/subunit/python/subunit/__init__.py | 6 ++++++ lib/subunit/python/subunit/run.py | 3 ++- lib/subunit/setup.py | 2 +- lib/subunit/shell/README | 2 +- lib/subunit/shell/tests/test_function_output.sh | 10 +++++----- lib/subunit/shell/tests/test_source_library.sh | 14 +++++++------- 8 files changed, 47 insertions(+), 16 deletions(-) diff --git a/lib/subunit/INSTALL b/lib/subunit/INSTALL index 79cf7c18d00..06122552eda 100644 --- a/lib/subunit/INSTALL +++ b/lib/subunit/INSTALL @@ -14,7 +14,7 @@ Dependencies * Python for the filters * 'testtools' (On Debian and Ubuntu systems the 'python-testtools' package, the testtools package on pypi, or https://launchpad.net/testtools) for - the extended test API which permits attachments. Version 0.9.2 or newer is + the extended test API which permits attachments. Version 0.9.8 or newer is required. Of particular note, http://testtools.python-hosting.com/ is not the testtools you want. * A C compiler for the C bindings @@ -23,3 +23,10 @@ Dependencies * python-gtk2 if you wish to use subunit2gtk * python-junitxml if you wish to use subunit2junitxml * pkg-config for configure detection of supporting libraries. + +Binary packages +--------------- + +A number of distributions now include subunit, you can try via your package +manager. The authors maintain a personal package archive on Launchpad:: + https://launchpad.net/~testing-cabal/+archive/archive diff --git a/lib/subunit/NEWS b/lib/subunit/NEWS index 1af8ef57081..f1fd9ce06fb 100644 --- a/lib/subunit/NEWS +++ b/lib/subunit/NEWS @@ -5,6 +5,19 @@ subunit release notes NEXT (In development) --------------------- +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 +user of such functionality. + +IMPROVEMENTS +~~~~~~~~~~~~ + +* The ``subunit.run`` Python module supports ``-l`` and ``--load-list`` as + per ``testtools.run``. This required a dependency bump due to a small + API change in ``testtools``. (Robert Collins) + + 0.0.6 ----- @@ -48,6 +61,10 @@ IMPROVEMENTS non-details based test information; this should consistently UTF8 encode such strings. +* The Python TestProtocolClient now flushes output on startTest and stopTest. + (Martin [gz]). + + 0.0.5 ----- diff --git a/lib/subunit/python/subunit/__init__.py b/lib/subunit/python/subunit/__init__.py index b6f0108f618..b2c7a29237c 100644 --- a/lib/subunit/python/subunit/__init__.py +++ b/lib/subunit/python/subunit/__init__.py @@ -646,7 +646,13 @@ class TestProtocolClient(testresult.TestResult): def startTest(self, test): """Mark a test as starting its test run.""" + super(TestProtocolClient, self).startTest(test) self._stream.write("test: %s\n" % test.id()) + self._stream.flush() + + def stopTest(self, test): + super(TestProtocolClient, self).stopTest(test) + self._stream.flush() def progress(self, offset, whence): """Provide indication about the progress/length of the test run. diff --git a/lib/subunit/python/subunit/run.py b/lib/subunit/python/subunit/run.py index daa241a606b..b390de33f78 100755 --- a/lib/subunit/python/subunit/run.py +++ b/lib/subunit/python/subunit/run.py @@ -69,4 +69,5 @@ class SubunitTestProgram(TestProgram): if __name__ == '__main__': stream = get_default_formatter() runner = SubunitTestRunner(stream) - SubunitTestProgram(module=None, argv=sys.argv, testRunner=runner) + SubunitTestProgram(module=None, argv=sys.argv, testRunner=runner, + stdout=sys.stdout) diff --git a/lib/subunit/setup.py b/lib/subunit/setup.py index b9d6c5acc20..2038d048260 100755 --- a/lib/subunit/setup.py +++ b/lib/subunit/setup.py @@ -9,7 +9,7 @@ except ImportError: else: extra = { 'install_requires': [ - 'testtools', + 'testtools>=0.9.6', ] } diff --git a/lib/subunit/shell/README b/lib/subunit/shell/README index 5f7cf376263..af894a2bd3e 100644 --- a/lib/subunit/shell/README +++ b/lib/subunit/shell/README @@ -38,7 +38,7 @@ a manually written test using the bindings might look like: subunit_start_test "test name" # determine if test passes or fails result=$(something) -if [ $result -eq 0 ]; then +if [ $result == 0 ]; then subunit_pass_test "test name" else subunit_fail_test "test name" < # @@ -29,7 +29,7 @@ echo 'test: subunit_start_test output' func_output=$(subunit_start_test "foo bar") func_status=$? -if [ $func_status -eq 0 -a "x$func_output" = "xtest: foo bar" ]; then +if [ $func_status == 0 -a "x$func_output" = "xtest: foo bar" ]; then echo 'success: subunit_start_test output' else echo 'failure: subunit_start_test output [' @@ -42,7 +42,7 @@ fi subunit_start_test "subunit_pass_test output" func_output=$(subunit_pass_test "foo bar") func_status=$? -if [ $func_status -eq 0 -a "x$func_output" = "xsuccess: foo bar" ]; then +if [ $func_status == 0 -a "x$func_output" = "xsuccess: foo bar" ]; then subunit_pass_test "subunit_pass_test output" else echo 'failure: subunit_pass_test output [' @@ -60,7 +60,7 @@ here END ) func_status=$? -if [ $func_status -eq 0 -a "x$func_output" = "xfailure: foo bar [ +if [ $func_status == 0 -a "x$func_output" = "xfailure: foo bar [ something wrong here @@ -82,7 +82,7 @@ here END ) func_status=$? -if [ $func_status -eq 0 -a "x$func_output" = "xerror: foo bar [ +if [ $func_status == 0 -a "x$func_output" = "xerror: foo bar [ something died here diff --git a/lib/subunit/shell/tests/test_source_library.sh b/lib/subunit/shell/tests/test_source_library.sh index 3ef6ffeb362..699f1281bc9 100755 --- a/lib/subunit/shell/tests/test_source_library.sh +++ b/lib/subunit/shell/tests/test_source_library.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # subunit shell bindings. # Copyright (C) 2006 Robert Collins # @@ -24,7 +24,7 @@ echo 'test: shell bindings can be sourced' # if any output occurs, this has failed to source cleanly source_output=$(. ${SHELL_SHARE}subunit.sh 2>&1) -if [ $? -eq 0 -a "x$source_output" = "x" ]; then +if [ $? == 0 -a "x$source_output" = "x" ]; then echo 'success: shell bindings can be sourced' else echo 'failure: shell bindings can be sourced [' @@ -40,7 +40,7 @@ fi echo 'test: subunit_start_test exists' found_type=$(type -t subunit_start_test) status=$? -if [ $status -eq 0 -a "x$found_type" = "xfunction" ]; then +if [ $status == 0 -a "x$found_type" = "xfunction" ]; then echo 'success: subunit_start_test exists' else echo 'failure: subunit_start_test exists [' @@ -54,7 +54,7 @@ fi echo 'test: subunit_pass_test exists' found_type=$(type -t subunit_pass_test) status=$? -if [ $status -eq 0 -a "x$found_type" = "xfunction" ]; then +if [ $status == 0 -a "x$found_type" = "xfunction" ]; then echo 'success: subunit_pass_test exists' else echo 'failure: subunit_pass_test exists [' @@ -68,7 +68,7 @@ fi echo 'test: subunit_fail_test exists' found_type=$(type -t subunit_fail_test) status=$? -if [ $status -eq 0 -a "x$found_type" = "xfunction" ]; then +if [ $status == 0 -a "x$found_type" = "xfunction" ]; then echo 'success: subunit_fail_test exists' else echo 'failure: subunit_fail_test exists [' @@ -82,7 +82,7 @@ fi echo 'test: subunit_error_test exists' found_type=$(type -t subunit_error_test) status=$? -if [ $status -eq 0 -a "x$found_type" = "xfunction" ]; then +if [ $status == 0 -a "x$found_type" = "xfunction" ]; then echo 'success: subunit_error_test exists' else echo 'failure: subunit_error_test exists [' @@ -96,7 +96,7 @@ fi echo 'test: subunit_skip_test exists' found_type=$(type -t subunit_skip_test) status=$? -if [ $status -eq 0 -a "x$found_type" = "xfunction" ]; then +if [ $status == 0 -a "x$found_type" = "xfunction" ]; then echo 'success: subunit_skip_test exists' else echo 'failure: subunit_skip_test exists [' -- 2.11.4.GIT