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

  • Committer: Martin Pool
  • Date: 2008-02-06 00:41:04 UTC
  • mfrom: (3215 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3219.
  • Revision ID: mbp@sourcefrog.net-20080206004104-mxtn32habuhjq6b8
Merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
from cStringIO import StringIO
22
22
import errno
23
23
import os
 
24
import re
24
25
import sys
25
26
import tempfile
26
27
 
120
121
        else:
121
122
            self.fail("expected error not raised")
122
123
 
 
124
    def assertLogStartsWith(self, log, string):
 
125
        """Like assertStartsWith, but skips the log timestamp."""
 
126
        self.assertContainsRe(log,
 
127
            '^\\d+\\.\\d+  ' + re.escape(string))
 
128
 
123
129
    def test_mutter_callsite_1(self):
124
130
        """mutter_callsite can capture 1 level of stack frame."""
125
131
        mutter_callsite(1, "foo %s", "a string")
126
132
        log = self._get_log(keep_log_file=True)
127
133
        # begin with the message
128
 
        self.assertStartsWith(log, 'foo a string\nCalled from:\n')
 
134
        self.assertLogStartsWith(log, 'foo a string\nCalled from:\n')
129
135
        # should show two frame: this frame and the one above
130
136
        self.assertContainsRe(log,
131
 
            'test_trace\.py", line \d+, in test_mutter_callsite_1\n')
 
137
            'test_trace\\.py", line \\d+, in test_mutter_callsite_1\n')
132
138
        # this frame should be the final one
133
139
        self.assertEndsWith(log, ' "a string")\n')
134
140
 
137
143
        mutter_callsite(2, "foo %s", "a string")
138
144
        log = self._get_log(keep_log_file=True)
139
145
        # begin with the message
140
 
        self.assertStartsWith(log, 'foo a string\nCalled from:\n')
 
146
        self.assertLogStartsWith(log, 'foo a string\nCalled from:\n')
141
147
        # should show two frame: this frame and the one above
142
148
        self.assertContainsRe(log,
143
149
            'test_trace.py", line \d+, in test_mutter_callsite_2\n')