~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/cmd_test_script.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-11-08 11:35:49 UTC
  • mfrom: (5531.1.3 662509-ignore-empty)
  • Revision ID: pqm@pqm.ubuntu.com-20101108113549-e4mhhq2fe1i0etbf
(vila) Add an option to accept any output from commands in shell-like tests.
 (Vincent Ladeuil)

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
"""Front-end command for shell-like test scripts.
18
18
 
19
 
See developers/testing.html for more explanations.
 
19
See doc/developers/testing.txt for more explanations.
20
20
This module should be importable even if testtools aren't available.
21
21
"""
22
22
 
23
23
import os
24
24
 
25
 
from bzrlib import commands
 
25
from bzrlib import (
 
26
    commands,
 
27
    option,
 
28
    )
26
29
 
27
30
 
28
31
class cmd_test_script(commands.Command):
30
33
 
31
34
    hidden = True
32
35
    takes_args = ['infile']
 
36
    takes_options = [
 
37
        option.Option('null-output',
 
38
                       help='Null command outputs match any output.'),
 
39
        ]
33
40
 
34
41
    @commands.display_command
35
 
    def run(self, infile):
 
42
    def run(self, infile, null_output=False):
36
43
        # local imports to defer testtools dependency
37
44
        from bzrlib import tests
38
45
        from bzrlib.tests.script import TestCaseWithTransportAndScript
48
55
            script = None # Set before running
49
56
 
50
57
            def test_it(self):
51
 
                self.run_script(script)
 
58
                self.run_script(script,
 
59
                                null_output_matches_anything=null_output)
52
60
 
53
61
        runner = tests.TextTestRunner(stream=self.outf)
54
62
        test = Test('test_it')