~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/cmd_test_script.py

  • Committer: Jelmer Vernooij
  • Date: 2011-12-16 19:18:39 UTC
  • mto: This revision was merged to the branch mainline in revision 6391.
  • Revision ID: jelmer@samba.org-20111216191839-eg681lxqibi1qxu1
Fix remaining tests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2009, 2010 Canonical Ltd
 
1
# Copyright (C) 2010 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
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')