Skip to content

Commit

Permalink
Merge pull request #169 from w3c/jgraham/pdb_argument
Browse files Browse the repository at this point in the history
Only drop into pdb on exception if --pdb is passed on the command line
  • Loading branch information
jgraham committed Feb 4, 2016
2 parents 0980c07 + 542d63c commit e40dac8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
3 changes: 3 additions & 0 deletions wptrunner/wptcommandline.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ def create_parser(product_choices=None):
debugging_group.add_argument("--stackwalk-binary", action="store", type=abs_path,
help="Path to stackwalker program used to analyse minidumps.")

debugging_group.add_argument("--pdb", action="store_true",
help="Drop into pdb on python exception")

chunking_group = parser.add_argument_group("Test Chunking")
chunking_group.add_argument("--total-chunks", action="store", type=int, default=1,
help="Total number of chunks to use")
Expand Down
13 changes: 8 additions & 5 deletions wptrunner/wptrunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,9 @@ def run_tests(config, test_paths, product, **kwargs):

def main():
"""Main entry point when calling from the command line"""
try:
kwargs = wptcommandline.parse_args()
kwargs = wptcommandline.parse_args()

try:
if kwargs["prefs_root"] is None:
kwargs["prefs_root"] = os.path.abspath(os.path.join(here, "prefs"))

Expand All @@ -230,6 +230,9 @@ def main():
else:
return not run_tests(**kwargs)
except Exception:
import pdb, traceback
print traceback.format_exc()
pdb.post_mortem()
if kwargs["pdb"]:
import pdb, traceback
print traceback.format_exc()
pdb.post_mortem()
else:
raise

0 comments on commit e40dac8

Please sign in to comment.