Skip to content

Commit

Permalink
Including stack information in ErrorScores on generic exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
JustasB committed Sep 20, 2018
1 parent f8ab784 commit 86e48ba
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions sciunit/tests.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""SciUnit tests live in this module."""

import inspect
import traceback

from sciunit.base import SciUnit
from .capabilities import ProducesNumber
Expand Down Expand Up @@ -240,6 +241,7 @@ def judge(self, model, skip_incapable=False, stop_on_error=True,
score.model = model
score.test = self
except Exception as e:
e.stack = traceback.format_exc()
score = ErrorScore(e)
score.model = model
score.test = self
Expand Down

2 comments on commit 86e48ba

@rgerkin
Copy link
Contributor

@rgerkin rgerkin commented on 86e48ba Sep 20, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JustasB This is a good one, thanks. You can also set stop_on_error to True when calling judge to get the traceback (of course, then your batch testing stops, but if you are just looking to pin down one error that is what I usually do).

@JustasB
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to know

Please sign in to comment.