/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/selftest/__init__.py

  • Committer: Martin Pool
  • Date: 2005-11-10 23:36:31 UTC
  • mto: (1185.33.43 bzr.dev)
  • mto: This revision was merged to the branch mainline in revision 1512.
  • Revision ID: mbp@sourcefrog.net-20051110233631-da361bc235b6da49
Remove direct logging calls from selftest

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
import unittest
28
28
import time
29
29
 
30
 
from logging import debug, warning, error
31
 
 
32
30
import bzrlib.commands
33
31
import bzrlib.trace
34
32
import bzrlib.osutils as osutils
 
33
from bzrlib.trace import mutter
35
34
from bzrlib.selftest import TestUtil
36
35
from bzrlib.selftest.TestUtil import TestLoader, TestSuite
37
36
from bzrlib.selftest.treeshape import build_tree_contents
223
222
        fileno, name = tempfile.mkstemp(suffix='.log', prefix='testbzr')
224
223
        self._log_file = os.fdopen(fileno, 'w+')
225
224
        bzrlib.trace.enable_test_log(self._log_file)
226
 
        debug('opened log file %s', name)
227
225
        self._log_file_name = name
228
226
        self.addCleanup(self._finishLogFile)
229
227
 
285
283
            callable()
286
284
 
287
285
    def log(self, *args):
288
 
        logging.debug(*args)
 
286
        mutter(*args)
289
287
 
290
288
    def _get_log(self):
291
289
        """Return as a string the log for this test"""
293
291
            return open(self._log_file_name).read()
294
292
        else:
295
293
            return self._log_contents
 
294
        # TODO: Delete the log after it's been read in
296
295
 
297
296
    def capture(self, cmd, retcode=0):
298
297
        """Shortcut that splits cmd into words, runs, and returns stdout"""
506
505
    def test_logging(self):
507
506
        """Test logs are captured when a test fails."""
508
507
        self.log('a test message')
 
508
        self._log_file.flush()
509
509
        self.assertContainsRe(self._get_log(), 'a test message\n')
510
510
 
511
511