~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/__init__.py

- Add assertContainsRe

Show diffs side-by-side

added added

removed removed

Lines of Context:
188
188
            return
189
189
        raise AssertionError("texts not equal:\n" + 
190
190
                             self._ndiff_strings(a, b))      
 
191
 
 
192
    def assertContainsRe(self, haystack, needle_re):
 
193
        """Assert that a contains something matching a regular expression."""
 
194
        if not re.search(needle_re, haystack):
 
195
            raise AssertionError('pattern "%s" not found in "%s"'
 
196
                    % (needle_re, haystack))
191
197
        
192
198
    def _enable_file_logging(self):
193
199
        fileno, name = tempfile.mkstemp(suffix='.log', prefix='testbzr')