/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_commands.py

  • Committer: Jelmer Vernooij
  • Date: 2012-01-02 14:41:49 UTC
  • mto: This revision was merged to the branch mainline in revision 6441.
  • Revision ID: jelmer@samba.org-20120102144149-66kkvew1kylagrk9
Drop exception suppression support.

Show diffs side-by-side

added added

removed removed

Lines of Context:
383
383
            self.assertEqual([], hook_calls)
384
384
            hook_calls.append('pre')
385
385
 
386
 
        def post_command(cmd, e):
 
386
        def post_command(cmd):
387
387
            self.assertEqual(['pre', 'run'], hook_calls)
388
388
            hook_calls.append('post')
389
389
 
405
405
    def test_post_hook_provided_exception(self):
406
406
        hook_calls = []
407
407
 
408
 
        def post_command(cmd, e):
409
 
            self.assertTrue(isinstance(e, self.TestError))
 
408
        def post_command(cmd):
410
409
            hook_calls.append('post')
411
410
 
412
411
        def run(cmd):
419
418
            "post_command", post_command, None)
420
419
 
421
420
        self.assertEqual([], hook_calls)
422
 
        self.assertRaises(self.TestError,
423
 
                          commands.run_bzr, [u'rocks'])
 
421
        self.assertRaises(self.TestError, commands.run_bzr, [u'rocks'])
424
422
        self.assertEqual(['run', 'post'], hook_calls)
425
423
 
426
 
    def test_pre_exception(self):
427
 
        """Ensure an exception in pre_command does not abort the command"""
428
 
 
429
 
        hook_calls = []
430
 
 
431
 
        def pre_command(cmd):
432
 
            hook_calls.append('pre')
433
 
            raise self.TestError()
434
 
 
435
 
        def post_command(cmd, e):
436
 
            hook_calls.append('post')
437
 
 
438
 
        def run(cmd):
439
 
            hook_calls.append('run')
440
 
 
441
 
        self.overrideAttr(builtins.cmd_rocks, 'run', run)
442
 
        commands.install_bzr_command_hooks()
443
 
        commands.Command.hooks.install_named_hook(
444
 
            "pre_command", pre_command, None)
445
 
        commands.Command.hooks.install_named_hook(
446
 
            "post_command", post_command, None)
447
 
 
448
 
        self.assertEqual([], hook_calls)
449
 
        self.run_bzr(['rocks', '-Oxx=12', '-Oyy=foo'])
450
 
        self.assertEqual(['pre', 'run', 'post'], hook_calls)
451
 
 
452
 
 
453
424
    def test_pre_command_error(self):
454
425
        """Ensure an BzrCommandError in pre_command aborts the command"""
455
426