Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
supporting pdb out of the box. closes #250
- Loading branch information
1 parent
dabe2cd
commit d79ed12
Showing
5 changed files
with
53 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
import sys | ||
from lettuce.terrain import after | ||
|
||
|
||
def enable(runner): | ||
@after.each_step | ||
def failfast_or_pdb(step): | ||
has_traceback = step.why | ||
|
||
if not has_traceback: | ||
return | ||
|
||
sys.stdout.write(step.why.traceback + '\n') | ||
|
||
try: | ||
from IPython.core.debugger import Pdb | ||
pdb = Pdb() | ||
except ImportError: | ||
try: | ||
from IPython.Debugger import Pdb | ||
from IPython.Shell import IPShell | ||
IPShell(argv=['']) | ||
pdb = Pdb() | ||
except ImportError: | ||
import pdb | ||
|
||
matched, defined = step.pre_run(False) | ||
if matched: | ||
args = matched.groups() | ||
kwargs = matched.groupdict() | ||
pdb.runcall(defined.function, step, *args, **kwargs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters