Skip to content

Commit

Permalink
Enabled terminal output when using set_trace() inside test cases run …
Browse files Browse the repository at this point in the history
…by nosetests
  • Loading branch information
Antti Kaihola committed Feb 17, 2010
1 parent 5dcd590 commit 0894324
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.txt
Expand Up @@ -15,3 +15,4 @@ Credits
-------

* patch from Jean Jordaan for correct setup of colors
* patch from Antti Kaihola for nose compatibility
9 changes: 9 additions & 0 deletions ipdb/__init__.py
Expand Up @@ -6,6 +6,15 @@
shell = IPShell(argv=[''])

def set_trace():
try:
import nose.core
from traceback import extract_stack
nose_core_path = nose.core.__file__.rstrip('c')
if nose_core_path in (entry[0] for entry in extract_stack()):
from IPython.Shell import Term
Term.cout = sys.stdout = sys.__stdout__
except ImportError:
pass
ip = ipapi.get()
def_colors = ip.options.colors
Pdb(def_colors).set_trace(sys._getframe().f_back)
4 changes: 4 additions & 0 deletions setup.py
Expand Up @@ -19,6 +19,10 @@
# -*- Extra requirements: -*-
'ipython',
],
extras_require={
# -*- Requirements for nose compatibility: -*-
'nosetests': ['nose'],
},
entry_points="""
# -*- Entry points: -*-
""",
Expand Down

0 comments on commit 0894324

Please sign in to comment.