Rev 4681: Continue script execution based on status not error output. in file:///home/vila/src/bzr/experimental/shell-like-tests/
Vincent Ladeuil
v.ladeuil+lp at free.fr
Wed Sep 9 14:56:07 BST 2009
At file:///home/vila/src/bzr/experimental/shell-like-tests/
------------------------------------------------------------
revno: 4681
revision-id: v.ladeuil+lp at free.fr-20090909135607-bfmm0gl738nx534g
parent: v.ladeuil+lp at free.fr-20090909134805-9upqicdxkuc69avk
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: shell-like-tests
timestamp: Wed 2009-09-09 15:56:07 +0200
message:
Continue script execution based on status not error output.
* bzrlib/tests/test_script.py:
(TestScriptExecution): Output on error stream is not an error.
* bzrlib/tests/script.py:
(ScriptRunner.run_command): Defines error based on returned status
not on error stream content.
-------------- next part --------------
=== modified file 'bzrlib/tests/script.py'
--- a/bzrlib/tests/script.py 2009-09-09 13:48:05 +0000
+++ b/bzrlib/tests/script.py 2009-09-09 13:56:07 +0000
@@ -38,6 +38,9 @@
If an error occurs and no expected error is specified, the execution stops.
+An error is defined by a returned status different from zero, not by the
+presence of text on the error stream.
+
The matching is done on a full string comparison basis unless '...' is used, in
which case expected output/errors can be lees precise.
@@ -265,7 +268,7 @@
self._check_output(output, actual_output)
self._check_output(error, actual_error)
- if not error and actual_error:
+ if retcode and not error and actual_error:
self.test_case.fail('Unexpected error: %s' % actual_error)
return retcode, actual_output, actual_error
=== modified file 'bzrlib/tests/test_script.py'
--- a/bzrlib/tests/test_script.py 2009-09-09 13:48:05 +0000
+++ b/bzrlib/tests/test_script.py 2009-09-09 13:56:07 +0000
@@ -113,6 +113,17 @@
"""
self.run_script(story)
+ def test_continue_on_error_output(self):
+ # The status matters, not the output
+ story = """
+bzr init
+cat >file
+<Hello
+bzr add file
+bzr commit -m 'adding file'
+"""
+ self.run_script(story)
+
def test_ellipsis_output(self):
story = """
cat
More information about the bazaar-commits
mailing list