Skip to content

Commit

Permalink
print traceback on error because it is possible that we've missed som…
Browse files Browse the repository at this point in the history
…e logging when exception is raised during exception handling
  • Loading branch information
swistakm committed May 19, 2019
1 parent 55949a3 commit 2c7bec6
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions conftest.py
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
import os
import sys
from traceback import print_exc

import pytest
from inspect import currentframe, getframeinfo
Expand Down Expand Up @@ -90,6 +91,7 @@ def exec_snippet(self, source):
exec(code, locals(), globals())
except Exception as err:
# note: quick and dirty way to annotate sources with error marker
print_exc()
lines = source.split('\n')
lines.insert(sys.exc_info()[2].tb_next.tb_lineno, "^^^")
self.code = "\n".join(lines)
Expand Down

0 comments on commit 2c7bec6

Please sign in to comment.