~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_trace.py

  • Committer: Vincent Ladeuil
  • Date: 2010-01-25 17:48:22 UTC
  • mto: (4987.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 4988.
  • Revision ID: v.ladeuil+lp@free.fr-20100125174822-nce4l19sbwx83jvq
Deploying the new overrideAttr facility further reduces the complexity
and make the code clearer.

Show diffs side-by-side

added added

removed removed

Lines of Context:
253
253
        # If _open_bzr_log cannot open the file, then we should write the
254
254
        # warning to stderr. Since this is normally happening before logging is
255
255
        # set up.
256
 
        self.addAttrCleanup(sys, 'stderr')
257
 
        sys.stderr = StringIO()
 
256
        self.overrideAttr(sys, 'stderr', StringIO())
258
257
        # Set the log file to something that cannot exist
 
258
        # FIXME: A bit dangerous: we are not in an isolated dir here -- vilajam
 
259
        # 20100125
259
260
        os.environ['BZR_LOG'] = os.getcwd() + '/no-dir/bzr.log'
260
 
        self.addAttrCleanup(trace, '_bzr_log_filename')
 
261
        self.overrideAttr(trace, '_bzr_log_filename')
261
262
        logf = trace._open_bzr_log()
262
263
        self.assertIs(None, logf)
263
264
        self.assertContainsRe(sys.stderr.getvalue(),
264
265
                              'failed to open trace file: .*/no-dir/bzr.log')
265
266
 
 
267
 
266
268
class TestVerbosityLevel(TestCase):
267
269
 
268
270
    def test_verbosity_level(self):