~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_trace.py

  • Committer: Martin Pool
  • Date: 2008-06-17 01:13:49 UTC
  • mto: (3495.3.3 trivial)
  • mto: This revision was merged to the branch mainline in revision 3501.
  • Revision ID: mbp@sourcefrog.net-20080617011349-jsqy1id9wgk2pqzs
Show short error for missing libraries

Show diffs side-by-side

added added

removed removed

Lines of Context:
93
93
        self.assertTrue(len(msg) > 0)
94
94
        self.assertEqualDiff(msg, 'bzr: ERROR: Not a branch: \"wibble\".\n')
95
95
 
 
96
    def test_report_external_import_error(self):
 
97
        """Short friendly message for missing system modules."""
 
98
        try:
 
99
            import ImaginaryModule
 
100
        except ImportError, e:
 
101
            pass
 
102
        else:
 
103
            self.fail("somehow succeeded in importing %r" % ImaginaryModule)
 
104
        msg = _format_exception()
 
105
        self.assertEqual(msg,
 
106
            'bzr: ERROR: No module named ImaginaryModule\n'
 
107
            'You may need to install this Python library separately.\n')
 
108
 
 
109
    def test_report_import_syntax_error(self):
 
110
        try:
 
111
            raise ImportError("syntax error")
 
112
        except ImportError, e:
 
113
            pass
 
114
        msg = _format_exception()
 
115
        self.assertContainsRe(msg,
 
116
            r"Traceback \(most recent call last\)")
 
117
 
96
118
    def test_trace_unicode(self):
97
119
        """Write Unicode to trace log"""
98
120
        self.log(u'the unicode character for benzene is \N{BENZENE RING}')