~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_trace.py

  • Committer: Karl Bielefeldt
  • Date: 2010-10-06 13:34:50 UTC
  • mto: (5483.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 5484.
  • Revision ID: 7mq3cbbd9q@snkmail.com-20101006133450-jjsl0bdfekwj8gmf
Add test for message format with -Dmem_dump

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
import tempfile
27
27
 
28
28
from bzrlib import (
 
29
    debug,
29
30
    errors,
30
31
    trace,
31
32
    )
83
84
        self.assertEquals(msg,
84
85
            "bzr: out of memory\nUse -Dmem_dump to dump memory to a file.\n")
85
86
 
 
87
    def test_format_mem_dump(self):
 
88
        debug.debug_flags.add('mem_dump')
 
89
        try:
 
90
            raise MemoryError()
 
91
        except MemoryError:
 
92
            pass
 
93
        msg = _format_exception()
 
94
        self.assertStartsWith(msg,
 
95
            "bzr: out of memory\nMemory dumped to ")
 
96
 
86
97
    def test_format_os_error(self):
87
98
        try:
88
99
            os.rmdir('nosuchfile22222')