/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: Robert Collins
  • Date: 2008-02-06 04:06:42 UTC
  • mfrom: (3216 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3217.
  • Revision ID: robertc@robertcollins.net-20080206040642-2efx3l4iv5f95lxp
Merge up with bzr.dev.

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
 
26
27
from bzrlib import (
117
118
        else:
118
119
            self.fail("expected error not raised")
119
120
 
 
121
    def assertLogStartsWith(self, log, string):
 
122
        """Like assertStartsWith, but skips the log timestamp."""
 
123
        self.assertContainsRe(log,
 
124
            '^\\d+\\.\\d+  ' + re.escape(string))
 
125
 
120
126
    def test_mutter_callsite_1(self):
121
127
        """mutter_callsite can capture 1 level of stack frame."""
122
128
        mutter_callsite(1, "foo %s", "a string")
123
129
        log = self._get_log(keep_log_file=True)
124
130
        # begin with the message
125
 
        self.assertStartsWith(log, 'foo a string\nCalled from:\n')
 
131
        self.assertLogStartsWith(log, 'foo a string\nCalled from:\n')
126
132
        # should show two frame: this frame and the one above
127
133
        self.assertContainsRe(log,
128
 
            'test_trace\.py", line \d+, in test_mutter_callsite_1\n')
 
134
            'test_trace\\.py", line \\d+, in test_mutter_callsite_1\n')
129
135
        # this frame should be the final one
130
136
        self.assertEndsWith(log, ' "a string")\n')
131
137
 
134
140
        mutter_callsite(2, "foo %s", "a string")
135
141
        log = self._get_log(keep_log_file=True)
136
142
        # begin with the message
137
 
        self.assertStartsWith(log, 'foo a string\nCalled from:\n')
 
143
        self.assertLogStartsWith(log, 'foo a string\nCalled from:\n')
138
144
        # should show two frame: this frame and the one above
139
145
        self.assertContainsRe(log,
140
146
            'test_trace.py", line \d+, in test_mutter_callsite_2\n')