~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/script.py

  • Committer: Vincent Ladeuil
  • Date: 2010-11-08 09:58:04 UTC
  • mto: (5532.1.1 trunk)
  • mto: This revision was merged to the branch mainline in revision 5532.
  • Revision ID: v.ladeuil+lp@free.fr-20101108095804-uk34qhoyr7tfw4ay
s/blank_output/null_output/

Show diffs side-by-side

added added

removed removed

Lines of Context:
196
196
        self.output_checker = doctest.OutputChecker()
197
197
        self.check_options = doctest.ELLIPSIS
198
198
 
199
 
    def run_script(self, test_case, text, 
200
 
                   blank_output_matches_anything=False):
 
199
    def run_script(self, test_case, text, null_output_matches_anything=False):
201
200
        """Run a shell-like script as a test.
202
201
 
203
202
        :param test_case: A TestCase instance that should provide the fail(),
206
205
 
207
206
        :param text: A shell-like script (see _script_to_commands for syntax).
208
207
 
209
 
        :param blank_output_matches_anything: For commands with no specified
 
208
        :param null_output_matches_anything: For commands with no specified
210
209
            output, ignore any output that does happen, including output on
211
210
            standard error.
212
211
        """
213
 
        self.blank_output_matches_anything = blank_output_matches_anything
 
212
        self.null_output_matches_anything = null_output_matches_anything
214
213
        for cmd, input, output, error in _script_to_commands(text):
215
214
            self.run_command(test_case, cmd, input, output, error)
216
215
 
252
251
                test_case.fail('expected output: %r, but found nothing'
253
252
                            % (expected,))
254
253
 
255
 
        blank_output_matches_anything = getattr(self, 
256
 
            'blank_output_matches_anything', False)
257
 
        if blank_output_matches_anything and expected is None: 
 
254
        null_output_matches_anything = getattr(
 
255
            self, 'null_output_matches_anything', False)
 
256
        if null_output_matches_anything and expected is None:
258
257
            return
259
 
        
 
258
 
260
259
        expected = expected or ''
261
260
        matching = self.output_checker.check_output(
262
261
            expected, actual, self.check_options)
485
484
        super(TestCaseWithMemoryTransportAndScript, self).setUp()
486
485
        self.script_runner = ScriptRunner()
487
486
 
488
 
    def run_script(self, script, blank_output_matches_anything=False):
 
487
    def run_script(self, script, null_output_matches_anything=False):
489
488
        return self.script_runner.run_script(self, script, 
490
 
                   blank_output_matches_anything=blank_output_matches_anything)
 
489
                   null_output_matches_anything=null_output_matches_anything)
491
490
 
492
491
    def run_command(self, cmd, input, output, error):
493
492
        return self.script_runner.run_command(self, cmd, input, output, error)
515
514
        super(TestCaseWithTransportAndScript, self).setUp()
516
515
        self.script_runner = ScriptRunner()
517
516
 
518
 
    def run_script(self, script, blank_output_matches_anything=False):
 
517
    def run_script(self, script, null_output_matches_anything=False):
519
518
        return self.script_runner.run_script(self, script,
520
 
                   blank_output_matches_anything=blank_output_matches_anything)
 
519
                   null_output_matches_anything=null_output_matches_anything)
521
520
 
522
521
    def run_command(self, cmd, input, output, error):
523
522
        return self.script_runner.run_command(self, cmd, input, output, error)
524
523
 
525
524
 
526
 
def run_script(test_case, script_string, blank_output_matches_anything=False):
 
525
def run_script(test_case, script_string, null_output_matches_anything=False):
527
526
    """Run the given script within a testcase"""
528
527
    return ScriptRunner().run_script(test_case, script_string,
529
 
               blank_output_matches_anything=blank_output_matches_anything)
 
528
               null_output_matches_anything=null_output_matches_anything)
530
529