summaryrefslogtreecommitdiff
path: root/coverage/misc.py
diff options
context:
space:
mode:
Diffstat (limited to 'coverage/misc.py')
-rw-r--r--coverage/misc.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/coverage/misc.py b/coverage/misc.py
index 0e6bcf99..4218536d 100644
--- a/coverage/misc.py
+++ b/coverage/misc.py
@@ -60,6 +60,14 @@ def expensive(fn):
return _wrapped
+def bool_or_none(b):
+ """Return bool(b), but preserve None."""
+ if b is None:
+ return None
+ else:
+ return bool(b)
+
+
class CoverageException(Exception):
"""An exception specific to Coverage."""
pass
@@ -67,3 +75,11 @@ class CoverageException(Exception):
class NoSource(CoverageException):
"""Used to indicate we couldn't find the source for a module."""
pass
+
+class ExceptionDuringRun(CoverageException):
+ """An exception happened while running customer code.
+
+ Construct it with three arguments, the values from `sys.exc_info`.
+
+ """
+ pass