turn FormattedExcinfo into a attrs class
This commit is contained in:
parent
c67f45b716
commit
74884b1901
|
@ -3,6 +3,8 @@ import inspect
|
||||||
import sys
|
import sys
|
||||||
import traceback
|
import traceback
|
||||||
from inspect import CO_VARARGS, CO_VARKEYWORDS
|
from inspect import CO_VARARGS, CO_VARKEYWORDS
|
||||||
|
|
||||||
|
import attr
|
||||||
import re
|
import re
|
||||||
from weakref import ref
|
from weakref import ref
|
||||||
from _pytest.compat import _PY2, _PY3, PY35, safe_str
|
from _pytest.compat import _PY2, _PY3, PY35, safe_str
|
||||||
|
@ -458,19 +460,19 @@ class ExceptionInfo(object):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
@attr.s
|
||||||
class FormattedExcinfo(object):
|
class FormattedExcinfo(object):
|
||||||
""" presenting information about failing Functions and Generators. """
|
""" presenting information about failing Functions and Generators. """
|
||||||
# for traceback entries
|
# for traceback entries
|
||||||
flow_marker = ">"
|
flow_marker = ">"
|
||||||
fail_marker = "E"
|
fail_marker = "E"
|
||||||
|
|
||||||
def __init__(self, showlocals=False, style="long", abspath=True, tbfilter=True, funcargs=False):
|
showlocals = attr.ib(default=False)
|
||||||
self.showlocals = showlocals
|
style = attr.ib(default="long")
|
||||||
self.style = style
|
abspath = attr.ib(default=True)
|
||||||
self.tbfilter = tbfilter
|
tbfilter = attr.ib(default=True)
|
||||||
self.funcargs = funcargs
|
funcargs = attr.ib(default=False)
|
||||||
self.abspath = abspath
|
astcache = attr.ib(default=attr.Factory(dict), init=False, repr=False)
|
||||||
self.astcache = {}
|
|
||||||
|
|
||||||
def _getindent(self, source):
|
def _getindent(self, source):
|
||||||
# figure out indent for given source
|
# figure out indent for given source
|
||||||
|
|
Loading…
Reference in New Issue