/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_errors.py

  • Committer: Vincent Ladeuil
  • Date: 2011-08-16 13:12:40 UTC
  • mfrom: (6071 +trunk)
  • mto: This revision was merged to the branch mainline in revision 6076.
  • Revision ID: v.ladeuil+lp@free.fr-20110816131240-gcyn9cik86dxwgz3
Merge into trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
300
300
            str(error))
301
301
 
302
302
    def test_up_to_date(self):
303
 
        error = errors.UpToDateFormat(bzrdir.BzrDirFormat4())
304
 
        self.assertEqualDiff("The branch format All-in-one "
305
 
                             "format 4 is already at the most "
306
 
                             "recent format.",
307
 
                             str(error))
 
303
        error = errors.UpToDateFormat("someformat")
 
304
        self.assertEqualDiff(
 
305
            "The branch format someformat is already at the most "
 
306
            "recent format.", str(error))
308
307
 
309
308
    def test_corrupt_repository(self):
310
309
        repo = self.make_repository('.')
578
577
        try:
579
578
            1/0
580
579
        except ZeroDivisionError:
581
 
            exc_info = sys.exc_info()
582
 
        err = errors.HookFailed('hook stage', 'hook name', exc_info, warn=False)
583
 
        self.assertStartsWith(
584
 
            str(err), 'Hook \'hook name\' during hook stage failed:\n')
585
 
        self.assertEndsWith(
586
 
            str(err), 'integer division or modulo by zero')
 
580
            err = errors.HookFailed('hook stage', 'hook name', sys.exc_info(),
 
581
                warn=False)
 
582
        # GZ 2010-11-08: Should not store exc_info in exception instances, but
 
583
        #                HookFailed is deprecated anyway and could maybe go.
 
584
        try:
 
585
            self.assertStartsWith(
 
586
                str(err), 'Hook \'hook name\' during hook stage failed:\n')
 
587
            self.assertEndsWith(
 
588
                str(err), 'integer division or modulo by zero')
 
589
        finally:
 
590
            del err
587
591
 
588
592
    def test_tip_change_rejected(self):
589
593
        err = errors.TipChangeRejected(u'Unicode message\N{INTERROBANG}')
612
616
        try:
613
617
            raise Exception("example error")
614
618
        except Exception:
615
 
            exc_info = sys.exc_info()
616
 
        err = errors.SmartMessageHandlerError(exc_info)
617
 
        self.assertStartsWith(
618
 
            str(err), "The message handler raised an exception:\n")
619
 
        self.assertEndsWith(str(err), "Exception: example error\n")
 
619
            err = errors.SmartMessageHandlerError(sys.exc_info())
 
620
        # GZ 2010-11-08: Should not store exc_info in exception instances.
 
621
        try:
 
622
            self.assertStartsWith(
 
623
                str(err), "The message handler raised an exception:\n")
 
624
            self.assertEndsWith(str(err), "Exception: example error\n")
 
625
        finally:
 
626
            del err
620
627
 
621
628
    def test_must_have_working_tree(self):
622
629
        err = errors.MustHaveWorkingTree('foo', 'bar')