/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 bzrlib/debug.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-08-20 11:49:38 UTC
  • mfrom: (6082.3.4 412201-mv-case-insensitive)
  • Revision ID: pqm@pqm.ubuntu.com-20110820114938-wwxmzhexrielxpq3
(vila) Allow blackbox tests and test scripts interactive debugging. (Vincent
 Ladeuil)

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
for a list of the available options.
25
25
"""
26
26
 
27
 
 
28
27
debug_flags = set()
29
28
 
30
29
 
36
35
    c = config.GlobalStack()
37
36
    for f in c.get('debug_flags'):
38
37
        debug_flags.add(f)
 
38
 
 
39
 
 
40
def set_trace():
 
41
    """Pdb using original stdin and stdout.
 
42
 
 
43
    When debugging blackbox tests, sys.stdin and sys.stdout are captured for
 
44
    test purposes and cannot be used for interactive debugging. This class uses
 
45
    the origianl stdin/stdout to allow such use.
 
46
 
 
47
    Instead of doing:
 
48
 
 
49
       import pdb; pdb.set_trace()
 
50
 
 
51
    you can do:
 
52
 
 
53
       from bzrlib import debug; debug.set_trace()
 
54
    """
 
55
    import pdb
 
56
    import sys
 
57
    pdb.Pdb(stdin=sys.__stdin__, stdout=sys.__stdout__
 
58
            ).set_trace(sys._getframe().f_back)