Rev 5534: Implements --null-ouput for the test-script command. in file:///home/vila/src/bzr/bugs/662509-ignore-empty/
Vincent Ladeuil
v.ladeuil+lp at free.fr
Mon Nov 8 10:53:53 GMT 2010
At file:///home/vila/src/bzr/bugs/662509-ignore-empty/
------------------------------------------------------------
revno: 5534
revision-id: v.ladeuil+lp at free.fr-20101108105353-nntejqprr3nislcw
parent: v.ladeuil+lp at free.fr-20101108095804-uk34qhoyr7tfw4ay
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: 662509-ignore-empty
timestamp: Mon 2010-11-08 11:53:53 +0100
message:
Implements --null-ouput for the test-script command.
-------------- next part --------------
=== modified file 'bzrlib/cmd_test_script.py'
--- a/bzrlib/cmd_test_script.py 2010-11-08 09:58:04 +0000
+++ b/bzrlib/cmd_test_script.py 2010-11-08 10:53:53 +0000
@@ -22,7 +22,10 @@
import os
-from bzrlib import commands
+from bzrlib import (
+ commands,
+ option,
+ )
class cmd_test_script(commands.Command):
@@ -30,9 +33,13 @@
hidden = True
takes_args = ['infile']
+ takes_options = [
+ option.Option('null-output',
+ help='Null command outputs match any output.'),
+ ]
@commands.display_command
- def run(self, infile):
+ def run(self, infile, null_output=False):
# local imports to defer testtools dependency
from bzrlib import tests
from bzrlib.tests.script import TestCaseWithTransportAndScript
@@ -48,7 +55,8 @@
script = None # Set before running
def test_it(self):
- self.run_script(script)
+ self.run_script(script,
+ null_output_matches_anything=null_output)
runner = tests.TextTestRunner(stream=self.outf)
test = Test('test_it')
=== modified file 'bzrlib/tests/blackbox/test_script.py'
--- a/bzrlib/tests/blackbox/test_script.py 2010-10-13 13:57:22 +0000
+++ b/bzrlib/tests/blackbox/test_script.py 2010-11-08 10:53:53 +0000
@@ -50,6 +50,16 @@
self.assertEquals('OK', out_lines[-1])
self.assertEquals('', err)
+ def test_null_output(self):
+ self.build_tree_contents([('script', '''
+$ echo hello world
+''')])
+ out, err = self.run_bzr(['test-script', 'script', '--null-output'])
+ out_lines = out.splitlines()
+ self.assertStartsWith(out_lines[-3], 'Ran 1 test in ')
+ self.assertEquals('OK', out_lines[-1])
+ self.assertEquals('', err)
+
def test_failing_script(self):
self.build_tree_contents([('script', '''
$ echo hello foo
More information about the bazaar-commits
mailing list