~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_trace.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-12-01 02:40:20 UTC
  • mfrom: (4843.1.1 integration)
  • Revision ID: pqm@pqm.ubuntu.com-20091201024020-8uqp6v8p2xqppu36
(igc) Faster log by less outf.write() calls

Show diffs side-by-side

added added

removed removed

Lines of Context:
84
84
    def test_format_os_error(self):
85
85
        try:
86
86
            os.rmdir('nosuchfile22222')
87
 
        except OSError:
88
 
            pass
 
87
        except OSError, e:
 
88
            e_str = str(e)
89
89
        msg = _format_exception()
90
 
        self.assertContainsRe(msg,
91
 
            r'^bzr: ERROR: \[Errno .*\] No such file.*nosuchfile22222')
 
90
        # Linux seems to give "No such file" but Windows gives "The system
 
91
        # cannot find the file specified".
 
92
        self.assertEqual('bzr: ERROR: %s\n' % (e_str,), msg)
92
93
 
93
94
    def test_format_io_error(self):
94
95
        try:
96
97
        except IOError:
97
98
            pass
98
99
        msg = _format_exception()
99
 
        self.assertContainsRe(msg, r'^bzr: ERROR: \[Errno .*\] No such file.*nosuchfile')
 
100
        # Even though Windows and Linux differ for 'os.rmdir', they both give
 
101
        # 'No such file' for open()
 
102
        self.assertContainsRe(msg,
 
103
            r'^bzr: ERROR: \[Errno .*\] No such file.*nosuchfile')
100
104
 
101
105
    def test_format_unicode_error(self):
102
106
        try:
268
272
    def test_log_rollover(self):
269
273
        temp_log_name = 'test-log'
270
274
        trace_file = open(temp_log_name, 'at')
271
 
        trace_file.write('test_log_rollover padding\n' * 1000000)
 
275
        trace_file.writelines(['test_log_rollover padding\n'] * 200000)
272
276
        trace_file.close()
273
277
        _rollover_trace_maybe(temp_log_name)
274
278
        # should have been rolled over