~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_trace.py

  • Committer: Robert Collins
  • Date: 2010-06-26 01:07:16 UTC
  • mto: This revision was merged to the branch mainline in revision 5324.
  • Revision ID: robertc@robertcollins.net-20100626010716-jowzrldm4ntsaki2
Make bzrlib startup use a trace context manager.

Show diffs side-by-side

added added

removed removed

Lines of Context:
333
333
        _rollover_trace_maybe(temp_log_name)
334
334
        # should have been rolled over
335
335
        self.assertFalse(os.access(temp_log_name, os.R_OK))
 
336
 
 
337
 
 
338
class TestTraceConfiguration(TestCaseInTempDir):
 
339
 
 
340
    def test_default_config(self):
 
341
        config = trace.DefaultConfig()
 
342
        self.overrideAttr(trace, "_bzr_log_filename", None)
 
343
        trace._bzr_log_filename = None
 
344
        expected_filename = trace._get_bzr_log_filename()
 
345
        self.assertEqual(None, trace._bzr_log_filename)
 
346
        config.__enter__()
 
347
        try:
 
348
            # Should have entered and setup a default filename.
 
349
            self.assertEqual(expected_filename, trace._bzr_log_filename)
 
350
        finally:
 
351
            config.__exit__(None, None, None)
 
352
            # Should have exited and cleaned up.
 
353
            self.assertEqual(None, trace._bzr_log_filename)