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
256
self.addCleanup(setattr, sys, 'stderr', sys.stderr)
257
self.addCleanup(setattr, trace, '_bzr_log_filename',
260
258
# Set the log file to something that cannot exist
261
259
os.environ['BZR_LOG'] = os.getcwd() + '/no-dir/bzr.log'
262
261
logf = trace._open_bzr_log()
263
262
self.assertIs(None, logf)
264
263
self.assertContainsRe(sys.stderr.getvalue(),