/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 breezy/tests/test_trace.py

  • Committer: Jelmer Vernooij
  • Date: 2019-07-27 22:47:49 UTC
  • mfrom: (7377 work)
  • mto: This revision was merged to the branch mainline in revision 7378.
  • Revision ID: jelmer@jelmer.uk-20190727224749-rta5fv1sc4ivy6ko
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
332
332
            sys.stderr.getvalue(),
333
333
            "failed to open trace file: .* '/no-such-dir/brz.log'$")
334
334
 
 
335
    def test__open_brz_log_ignores_cache_dir_error(self):
 
336
        # If the cache directory can not be created and _open_brz_log can thus
 
337
        # not open the file, then we should write the warning to stderr. Since
 
338
        # this is normally happening before logging is set up.
 
339
        self.overrideAttr(sys, 'stderr', StringIO())
 
340
        # Set the cache directory to something that cannot exist
 
341
        self.overrideEnv('BRZ_LOG', None)
 
342
        self.overrideEnv('BRZ_HOME', '/no-such-dir')
 
343
        self.overrideEnv('XDG_CACHE_HOME', '/no-such-dir')
 
344
        self.overrideAttr(trace, '_brz_log_filename')
 
345
        logf = trace._open_brz_log()
 
346
        self.assertIs(None, logf)
 
347
        self.assertContainsRe(
 
348
            sys.stderr.getvalue(),
 
349
            "failed to open trace file: .* '/no-such-dir'$")
 
350
 
335
351
 
336
352
class TestVerbosityLevel(TestCase):
337
353