~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_trace.py

  • Committer: Martin Pool
  • Date: 2009-03-09 12:35:43 UTC
  • mto: This revision was merged to the branch mainline in revision 4099.
  • Revision ID: mbp@sourcefrog.net-20090309123543-93ok3sjnduu2o8wf
Add more distinct tests for IOError and OSError

Show diffs side-by-side

added added

removed removed

Lines of Context:
70
70
 
71
71
    def test_format_os_error(self):
72
72
        try:
 
73
            os.rmdir('nosuchfile22222')
 
74
        except OSError:
 
75
            pass
 
76
        msg = _format_exception()
 
77
        self.assertContainsRe(msg,
 
78
            r'^bzr: ERROR: \[Errno .*\] No such file.*nosuchfile22222')
 
79
 
 
80
    def test_format_io_error(self):
 
81
        try:
73
82
            file('nosuchfile22222')
74
 
        except (OSError, IOError):
 
83
        except IOError:
75
84
            pass
76
85
        msg = _format_exception()
77
86
        self.assertContainsRe(msg, r'^bzr: ERROR: \[Errno .*\] No such file.*nosuchfile')